Class: Rack::MergeCookies
- Inherits:
-
Object
- Object
- Rack::MergeCookies
- Defined in:
- lib/rack/merge-cookies.rb,
lib/rack/merge-cookies/version.rb
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Method Summary collapse
- #call(env) ⇒ Object
- #custom_cookie_name ⇒ Object
-
#initialize(app, options = {}) ⇒ MergeCookies
constructor
A new instance of MergeCookies.
Constructor Details
#initialize(app, options = {}) ⇒ MergeCookies
Returns a new instance of MergeCookies.
3 4 5 |
# File 'lib/rack/merge-cookies.rb', line 3 def initialize(app, = {}) @app, @header_name = app, [:header_name] end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/rack/merge-cookies.rb', line 11 def call(env) = env[] unless .nil? = (env['HTTP_COOKIE'] || '').gsub(/;$/, '') env['HTTP_COOKIE'] = + '; ' + end @app.call(env) end |
#custom_cookie_name ⇒ Object
7 8 9 |
# File 'lib/rack/merge-cookies.rb', line 7 def 'HTTP_' + @header_name.upcase.gsub('-', '_') end |