Class: Rubasteme::AST::LeafNode

Inherits:
Node
  • Object
show all
Defined in:
lib/rubasteme/ast/leaf_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#to_s, #type

Constructor Details

#initialize(literal) ⇒ LeafNode

Returns a new instance of LeafNode.



7
8
9
10
# File 'lib/rubasteme/ast/leaf_node.rb', line 7

def initialize(literal)
  super
  @literal = literal
end

Instance Attribute Details

#literalObject (readonly)

Returns the value of attribute literal.



12
13
14
# File 'lib/rubasteme/ast/leaf_node.rb', line 12

def literal
  @literal
end

Instance Method Details

#to_aObject



14
15
16
# File 'lib/rubasteme/ast/leaf_node.rb', line 14

def to_a
  [type, @literal]
end