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


244
245
246
247
248
249
250
251
# File 'lib/ruote/reader/radial.rb', line 244

def initialize(first_line)

  @first_line = first_line

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

Instance Method Details

#to_aObject

Raises:

  • (ArgumentError)

253
254
255
256
257
258
259
260
# File 'lib/ruote/reader/radial.rb', line 253

def to_a

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

  @children.first.to_a
end