class Embork::Forwarder

Attributes

app[R]

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/embork/forwarder.rb, line 11
def initialize(app, options = {})
  @app = app
end
target() click to toggle source
# File lib/embork/forwarder.rb, line 2
def self.target
  @target
end
target=(target) click to toggle source
# File lib/embork/forwarder.rb, line 6
def self.target=(target)
  @target = target
end

Public Instance Methods

call(env) click to toggle source
# 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