Class: Cardiac::Client::SwitchHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/cardiac/client.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(app, match, switch) ⇒ SwitchHeaders

Returns a new instance of SwitchHeaders.



32
33
34
# File 'lib/cardiac/client.rb', line 32

def initialize(app,match,switch)
  @app, @match, @switch = app, match, switch
end

Instance Method Details

#call(env) ⇒ Object



36
37
38
39
# File 'lib/cardiac/client.rb', line 36

def call(env)
  status, headers, body = @app.call(env)
  [status, Hash[ headers.to_a.map{|k,v| [@match===k ? @switch+$' : k, v] }], body]
end