Module: Wombat::Crawler
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Processing::Parser
Processing::Parser::HTTP_METHODS
Instance Attribute Summary
Attributes included from Processing::Parser
#context, #mechanize, #page, #response_code
Instance Method Summary collapse
Methods included from Processing::Parser
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
44 45 46 |
# File 'lib/wombat/crawler.rb', line 44 def method_missing(method, *args, &block) self.class.send method, *args, &block end |
Instance Method Details
#crawl(url = nil, &block) ⇒ Object Also known as: scrape
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wombat/crawler.rb', line 20 def crawl(url = nil, &block) if block @metadata_dup = self.class..clone instance_eval do alias :old_method_missing :method_missing def method_missing method, *args, &block @metadata_dup.send method, *args, &block end end self.instance_eval &block parsed = parse(@metadata_dup, url) instance_eval do alias :method_missing :old_method_missing undef :old_method_missing remove_instance_variable :@metadata_dup end parsed else parse(self.class., url) end end |