Class: PEG::Node

Inherits:
ValueObject show all
Defined in:
lib/peg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ValueObject

#==

Constructor Details

#initialize(text, children = [], name = nil) ⇒ Node

Returns a new instance of Node.



11
12
13
# File 'lib/peg.rb', line 11

def initialize(text, children=[], name=nil)
  @text, @children, @name = text, children, name
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



9
10
11
# File 'lib/peg.rb', line 9

def children
  @children
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/peg.rb', line 9

def name
  @name
end

#textObject

Returns the value of attribute text.



9
10
11
# File 'lib/peg.rb', line 9

def text
  @text
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/peg.rb', line 15

def inspect
  "#{self.class}.new(#{text.inspect}, #{children.inspect}, #{name.inspect})"
end