Class: Ruote::RadialReader::PreRoot

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

Overview

Some kind of “root container”, to avoid having to deal with nils and making the parsing code more complicated (hopefully).

Instance Attribute Summary

Attributes inherited from Node

#children, #indentation, #parent

Instance Method Summary collapse

Constructor Details

#initialize(first_line) ⇒ PreRoot

Returns a new instance of PreRoot.



220
221
222
223
224
225
226
227
# File 'lib/ruote/reader/radial.rb', line 220

def initialize(first_line)

  @first_line = first_line

  @parent = nil
  @indentation = -1
  @children = []
end

Instance Method Details

#to_aObject

Raises:

  • (ArgumentError)


229
230
231
232
233
234
235
236
# File 'lib/ruote/reader/radial.rb', line 229

def to_a

  raise ArgumentError.new(
    "couldn't parse process definition out of >#{@first_line}<"
  ) unless @children.first

  @children.first.to_a
end