Class: Fu::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/fu/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Parser

Returns a new instance of Parser.



10
11
12
13
14
# File 'lib/fu/parser.rb', line 10

def initialize(text)
  @root = OpenStruct.new(:type => :root, :children => [])
  scanner = StringScanner.new(text.gsub(/\t/, '  '))
  parse_children(@root, scanner)
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



8
9
10
# File 'lib/fu/parser.rb', line 8

def root
  @root
end