Class: Relief::Parser
- Inherits:
-
Object
- Object
- Relief::Parser
- Defined in:
- lib/relief/parser.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(name = nil, options = {}, &block) ⇒ Parser
constructor
A new instance of Parser.
- #parse(document) ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
9 10 11 |
# File 'lib/relief/parser.rb', line 9 def root @root end |
Instance Method Details
#parse(document) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/relief/parser.rb', line 15 def parse(document) unless document.is_a?(Nokogiri::XML::NodeSet) document = Nokogiri::XML(document.to_s) end raise ParseError if document.root.nil? @root.parse(document) end |