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.



238
239
240
241
242
243
244
245
# File 'lib/ruote/reader/radial.rb', line 238

def initialize(first_line)

  @first_line = first_line

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

Instance Method Details

#to_aObject

Raises:

  • (ArgumentError)


247
248
249
250
251
252
253
254
# File 'lib/ruote/reader/radial.rb', line 247

def to_a

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

  @children.first.to_a
end