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, options = {}, &block) ⇒ Parser
constructor
A new instance of Parser.
- #parse(document) ⇒ Object
Constructor Details
#initialize(name, options = {}, &block) ⇒ Parser
Returns a new instance of Parser.
8 9 10 |
# File 'lib/relief/parser.rb', line 8 def initialize(name, ={}, &block) @root = Element.new(name, , &block) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/relief/parser.rb', line 6 def root @root end |
Instance Method Details
#parse(document) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/relief/parser.rb', line 12 def parse(document) unless document.is_a?(Nokogiri::XML::NodeSet) document = Nokogiri::XML(document) end @root.parse(document) end |