Class: Rack::Prerender
- Inherits:
-
Object
- Object
- Rack::Prerender
- Defined in:
- lib/rack/prerender.rb,
lib/rack/prerender/fetcher.rb,
lib/rack/prerender/version.rb,
lib/rack/prerender/constraint.rb
Defined Under Namespace
Classes: Constraint, Fetcher
Constant Summary collapse
- VERSION =
'1.6.2.1'
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
-
#fetcher ⇒ Object
readonly
Returns the value of attribute fetcher.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Prerender
constructor
A new instance of Prerender.
Constructor Details
#initialize(app, options = {}) ⇒ Prerender
Returns a new instance of Prerender.
10 11 12 13 14 |
# File 'lib/rack/prerender.rb', line 10 def initialize(app, = {}) @app = app @constraint = Constraint.new() @fetcher = Fetcher.new() end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
8 9 10 |
# File 'lib/rack/prerender.rb', line 8 def app @app end |
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
8 9 10 |
# File 'lib/rack/prerender.rb', line 8 def constraint @constraint end |
#fetcher ⇒ Object (readonly)
Returns the value of attribute fetcher.
8 9 10 |
# File 'lib/rack/prerender.rb', line 8 def fetcher @fetcher end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 |
# File 'lib/rack/prerender.rb', line 16 def call(env) constraint.matches?(env) && fetcher.call(env) || app.call(env) end |