Class: DateExprNode

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

Instance Method Summary collapse

Methods inherited from Node

#column

Constructor Details

#initialize(val) ⇒ DateExprNode

Returns a new instance of DateExprNode.



106
107
108
# File 'lib/code_generator.rb', line 106

def initialize val
  @value = val
end

Instance Method Details

#genObject



110
111
112
113
114
115
116
117
118
# File 'lib/code_generator.rb', line 110

def gen
  val = @value.gen
  if val == 'now'
    "Time.now.to_date"
  else
    # YYYY-MM-DD
    "Date.parse(\"#{val}\")"
  end
end