Class: TwoWaySQL::WhiteSpaceNode

Inherits:
Node
  • Object
show all
Defined in:
lib/twowaysql/node.rb

Instance Method Summary collapse

Constructor Details

#initialize(val, preserve) ⇒ WhiteSpaceNode

Returns a new instance of WhiteSpaceNode.



223
224
225
226
# File 'lib/twowaysql/node.rb', line 223

def initialize(val, preserve)
  @val = val
  @preserve = preserve
end

Instance Method Details

#accept(ctx) ⇒ Object



227
228
229
230
231
232
233
# File 'lib/twowaysql/node.rb', line 227

def accept(ctx)
  if @preserve
    ctx.add_sql(@val)
  else
    ctx.add_sql(" ")
  end
end