lib/nibbler.rb
# Parse the document and save values returned by selectors
Parse the document and save values returned by selectors
Parse the document and save values returned by selectors
def parse
      self.class.rules.each do |target, (selector, delegate, plural)|
        if plural
          send(target).concat @doc.search(selector).map { |i| parse_result(i, delegate) }
        else
          send("#{target}=", parse_result(@doc.at(selector), delegate))
        end
      end
      self
    end
def parse self . class . rules . each do | target , ( selector , delegate , plural ) | if plural send ( target ) . concat @doc . search ( selector ) . map { | i | parse_result ( i , delegate ) } else send ( "#{target}=" , parse_result ( @doc . at ( selector ) , delegate ) ) end end self end
Parse the document and save values returned by selectors
Parse the document and save values returned by selectors