Class: BrainLove::AST::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/brain_love/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ Node

Returns a new instance of Node.



7
8
9
# File 'lib/brain_love/ast.rb', line 7

def initialize(value = nil)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/brain_love/ast.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
# File 'lib/brain_love/ast.rb', line 11

def ==(other)
  self.class == other.class &&
  self.value == other.value
end

#accept(visitor) ⇒ Object



16
17
18
# File 'lib/brain_love/ast.rb', line 16

def accept(visitor)
  visitor.send("visit_#{self.class.to_s.split('::').last}", self)
end