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


149
150
151
152
153
154
155
156
157
158
# File 'lib/ruote/reader/radial.rb', line 149

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


147
148
149
# File 'lib/ruote/reader/radial.rb', line 147

def children
  @children
end

#indentationObject (readonly)

Returns the value of attribute indentation


147
148
149
# File 'lib/ruote/reader/radial.rb', line 147

def indentation
  @indentation
end

#parentObject

Returns the value of attribute parent


147
148
149
# File 'lib/ruote/reader/radial.rb', line 147

def parent
  @parent
end

Instance Method Details

#to_aObject


166
167
168
169
# File 'lib/ruote/reader/radial.rb', line 166

def to_a

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