Class: ActionDispatch::Cookies::CookieJar

Inherits:
Object
  • Object
show all
Defined in:
lib/appdev_support/action_dispatch/cookies/cookie_jar/fetch.rb,
lib/appdev_support/action_dispatch/cookies/cookie_jar/store.rb

Instance Method Summary collapse

Instance Method Details

#fetch(key, *fallback) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/appdev_support/action_dispatch/cookies/cookie_jar/fetch.rb', line 4

def fetch(key, *fallback)
  if has_key?(key)
    self.[](key)
  elsif fallback.present?
    fallback
  else
    raise KeyError, "Key not found. Could not find #{key} in cookies Hash."
  end
end