Class: Locomotive::Steam::CookieService
- Inherits:
-
Object
- Object
- Locomotive::Steam::CookieService
- Defined in:
- lib/locomotive/steam/services/cookie_service.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(request) ⇒ CookieService
constructor
A new instance of CookieService.
- #set(key, vals) ⇒ Object
Constructor Details
#initialize(request) ⇒ CookieService
Returns a new instance of CookieService.
6 7 8 9 10 |
# File 'lib/locomotive/steam/services/cookie_service.rb', line 6 def initialize(request) @request = request request.env['steam.cookies'] ||= {} @cookies = request.env['steam.cookies'] end |
Instance Method Details
#get(key) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/locomotive/steam/services/cookie_service.rb', line 16 def get(key) if @cookies.include?(key) @cookies[key]['value'] else @request.[key] end end |
#set(key, vals) ⇒ Object
12 13 14 |
# File 'lib/locomotive/steam/services/cookie_service.rb', line 12 def set(key, vals) @cookies[key] = vals end |