Class: Ruote::RadialReader::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ruote/reader/radial.rb

Overview

A helper class to store the temporary tree while it gets read.

Direct Known Subclasses

PreRoot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indentation, expname, attributes) ⇒ Node

Returns a new instance of Node.



143
144
145
146
147
148
149
150
151
152
# File 'lib/ruote/reader/radial.rb', line 143

def initialize(indentation, expname, attributes)

  @parent = nil
  @indentation = indentation
  @children = []

  @expname = expname#.gsub(/-/, '_')
  @expname.gsub!(/-/, '_') if @expname.match(/^[a-z\-]+$/)
  @attributes = attributes
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



141
142
143
# File 'lib/ruote/reader/radial.rb', line 141

def children
  @children
end

#indentationObject (readonly)

Returns the value of attribute indentation.



141
142
143
# File 'lib/ruote/reader/radial.rb', line 141

def indentation
  @indentation
end

#parentObject

Returns the value of attribute parent.



141
142
143
# File 'lib/ruote/reader/radial.rb', line 141

def parent
  @parent
end

Instance Method Details

#to_aObject



160
161
162
163
# File 'lib/ruote/reader/radial.rb', line 160

def to_a

  [ @expname, @attributes, @children.collect { |c| c.to_a } ]
end