Module: Wombat::Parser
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#mechanize ⇒ Object
Returns the value of attribute mechanize.
-
#response_code ⇒ Object
Returns the value of attribute response_code.
Instance Method Summary collapse
Methods included from PropertyLocator
Methods included from NodeSelector
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
9 10 11 |
# File 'lib/wombat/parser.rb', line 9 def context @context end |
#mechanize ⇒ Object
Returns the value of attribute mechanize.
9 10 11 |
# File 'lib/wombat/parser.rb', line 9 def mechanize @mechanize end |
#response_code ⇒ Object
Returns the value of attribute response_code.
9 10 11 |
# File 'lib/wombat/parser.rb', line 9 def response_code @response_code end |
Instance Method Details
#initialize ⇒ Object
11 12 13 |
# File 'lib/wombat/parser.rb', line 11 def initialize @mechanize = Mechanize.new end |
#parse(metadata) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wombat/parser.rb', line 15 def parse() self.context = parser_for original_context = self.context .iterators.each do |it| it.reset # Clean up iterator results before starting select_nodes(it.selector).each do |node| self.context = node it.parse { |p| locate p } end end self.context = original_context .parse { |p| locate p } .flatten end |