Class: IfDefPattern

Inherits:
Object show all
Defined in:
ext/generate.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, iftrue, iffalse) ⇒ IfDefPattern

Returns a new instance of IfDefPattern.



95
96
97
98
99
100
# File 'ext/generate.rb', line 95

def initialize(name, iftrue, iffalse)
  @name = name
  @iftrue = iftrue
  @iffalse = iffalse
  super()
end

Instance Method Details

#dump(captured, out) ⇒ Object



110
111
112
113
114
115
116
# File 'ext/generate.rb', line 110

def dump(captured, out)
  out.puts "#ifdef #{@name}"
  @iftrue.dump(captured, out)
  out.puts "#else"
  @iffalse.dump(captured, out)
  out.puts "#endif"
end

#matches_end(str) ⇒ Object



106
107
108
# File 'ext/generate.rb', line 106

def matches_end(str)
  return @iftrue.matches_end(str) || @iffalse.matches_end(str)
end

#matches_start(str) ⇒ Object



102
103
104
# File 'ext/generate.rb', line 102

def matches_start(str)
  return @iftrue.matches_start(str) || @iffalse.matches_start(str)
end