Class: Fu::Parser
- Inherits:
-
Object
- Object
- Fu::Parser
- Defined in:
- lib/fu/parser.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(text) ⇒ Parser
constructor
A new instance of Parser.
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
#root ⇒ Object (readonly)
Returns the value of attribute root.
8 9 10 |
# File 'lib/fu/parser.rb', line 8 def root @root end |