Class: Snapcrawl::Crawler
- Inherits:
-
Object
- Object
- Snapcrawl::Crawler
- Defined in:
- lib/snapcrawl/crawler.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #crawl ⇒ Object
-
#initialize(url) ⇒ Crawler
constructor
A new instance of Crawler.
Constructor Details
#initialize(url) ⇒ Crawler
Returns a new instance of Crawler.
9 10 11 12 13 14 15 16 17 |
# File 'lib/snapcrawl/crawler.rb', line 9 def initialize(url) $logger.debug "initializing crawler with %{green}#{url}%{reset}" config_for_display = Config.settings.dup config_for_display['name_template'] = '%%{url}' $logger.debug "config #{config_for_display}" @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/snapcrawl/crawler.rb', line 7 def url @url end |
Instance Method Details
#crawl ⇒ Object
19 20 21 22 23 |
# File 'lib/snapcrawl/crawler.rb', line 19 def crawl Dependencies.verify todo[url] = Page.new url process_todo while todo.any? end |