Class: TypedExprNode

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

Instance Method Summary collapse

Constructor Details

#initialize(val, *args) ⇒ TypedExprNode

Returns a new instance of TypedExprNode.



75
76
77
78
79
80
81
82
83
84
# File 'lib/code_generator.rb', line 75

def initialize val, *args
  @children = args
  @type = @children[0]
  @value = case @type.gen
           when 'text' then TextNode.new(val)
           when 'date' then DateExprNode.new(val)
           else
             raise "Unknown type: #{@children[0]}"
           end
end

Instance Method Details

#columnObject



86
87
88
# File 'lib/code_generator.rb', line 86

def column
  @value.column
end

#genObject



90
91
92
# File 'lib/code_generator.rb', line 90

def gen
  @value.gen
end