Class: GoogleAjaxCrawler::Crawler
- Inherits:
-
Object
- Object
- GoogleAjaxCrawler::Crawler
- Defined in:
- lib/google_ajax_crawler/crawler.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app = nil, &block) ⇒ Crawler
constructor
A new instance of Crawler.
- #options ⇒ Object
Constructor Details
#initialize(app = nil, &block) ⇒ Crawler
Returns a new instance of Crawler.
16 17 18 19 |
# File 'lib/google_ajax_crawler/crawler.rb', line 16 def initialize(app = nil, &block) @app = app self.class.configure &block end |
Class Method Details
.configure(&block) ⇒ Object
11 12 13 |
# File 'lib/google_ajax_crawler/crawler.rb', line 11 def configure(&block) @options = Options.new(self, &block) end |
.options ⇒ Object
6 7 8 9 |
# File 'lib/google_ajax_crawler/crawler.rb', line 6 def configure if @options.nil? @options end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/google_ajax_crawler/crawler.rb', line 25 def call(env) request = Rack::Request.new(env) return serve_crawlable_content_for(request) if is_search_engine?(request) @app.call(env) end |
#options ⇒ Object
21 22 23 |
# File 'lib/google_ajax_crawler/crawler.rb', line 21 def self.class. end |