Class: FBO::Parser
- Inherits:
-
Object
- Object
- FBO::Parser
- Defined in:
- lib/fbo/parser.rb
Instance Method Summary collapse
-
#initialize(file = nil) ⇒ Parser
constructor
A new instance of Parser.
- #parse(data = nil) ⇒ Object
Constructor Details
#initialize(file = nil) ⇒ Parser
Returns a new instance of Parser.
9 10 11 |
# File 'lib/fbo/parser.rb', line 9 def initialize(file = nil) @file = file end |
Instance Method Details
#parse(data = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fbo/parser.rb', line 13 def parse(data = nil) data ||= @file.contents if data.respond_to? :each @tree = parse_collection(data) else @tree = parse_string(data) end @tree end |