Class: Embork::Pushstate
- Inherits:
-
Object
- Object
- Embork::Pushstate
- Defined in:
- lib/embork/pushstate.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Pushstate
constructor
A new instance of Pushstate.
Constructor Details
#initialize(app, options = {}) ⇒ Pushstate
Returns a new instance of Pushstate.
3 4 5 |
# File 'lib/embork/pushstate.rb', line 3 def initialize(app, = {}) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
2 3 4 |
# File 'lib/embork/pushstate.rb', line 2 def app @app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/embork/pushstate.rb', line 7 def call(env) status, headers, body = @app.call(env) if status == 404 env['PATH_INFO'] = '/index.html' @app.call(env) else [ status, headers, body ] end end |