Class: Ingestor::Parser::Xml
- Inherits:
-
Object
- Object
- Ingestor::Parser::Xml
- Includes:
- Base
- Defined in:
- lib/ingestor/parser/xml.rb
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#options(opts = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ingestor/parser/xml.rb', line 12 def (opts={}) @options = { :encoding => nil, :xpath => nil }.merge(opts) end |
#process! ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ingestor/parser/xml.rb', line 23 def process! document.xpath(@options[:xpath]).each do |node| node_attrs = Hash.from_xml(node.to_s) attrs = @proxy.[:map_attributes].call( node_attrs ) @proxy.process_entry attrs end end |
#sample! ⇒ Object
19 20 21 |
# File 'lib/ingestor/parser/xml.rb', line 19 def sample! puts Hash.from_xml( document.xpath(@options[:xpath]).first.to_s ) end |