Class: Hashbang::Railtie::Middleware
- Inherits:
-
Object
- Object
- Hashbang::Railtie::Middleware
- Defined in:
- lib/hashbang/railtie/middleware.rb
Instance Method Summary collapse
- #call(environment) ⇒ Object
-
#initialize(application) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(application) ⇒ Middleware
Returns a new instance of Middleware.
4 5 6 7 |
# File 'lib/hashbang/railtie/middleware.rb', line 4 def initialize(application) @application = application Headless.new.start end |
Instance Method Details
#call(environment) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hashbang/railtie/middleware.rb', line 9 def call(environment) if environment['QUERY_STRING'].include? "_escaped_fragment_" url = Crawler.urlFromRack(environment) html = Crawler.gimme url, 100000 [200, {"Content-Type" => "text/html; charset=utf-8"}, [html]] else @application.call(environment) end end |