Class: Embork::Forwarder
- Inherits:
-
Object
- Object
- Embork::Forwarder
- Defined in:
- lib/embork/forwarder.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Forwarder
constructor
A new instance of Forwarder.
Constructor Details
#initialize(app, options = {}) ⇒ Forwarder
Returns a new instance of Forwarder.
11 12 13 |
# File 'lib/embork/forwarder.rb', line 11 def initialize(app, = {}) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/embork/forwarder.rb', line 10 def app @app end |
Class Method Details
.target ⇒ Object
2 3 4 |
# File 'lib/embork/forwarder.rb', line 2 def self.target @target end |
.target=(target) ⇒ Object
6 7 8 |
# File 'lib/embork/forwarder.rb', line 6 def self.target=(target) @target = target end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/embork/forwarder.rb', line 15 def call(env) status, headers, body = @app.call(env) if status == 404 status, headers, body = self.class.target.new(@app).call(env) headers['Push-State-Redirect'] = 'true' end [ status, headers, body ] end |