Class: Cookie::Registry
- Inherits:
-
Object
- Object
- Cookie::Registry
- Includes:
- Adamantium::Flat
- Defined in:
- lib/cookie/registry.rb
Overview
Models a registry of Cookie instances
Constant Summary collapse
- UNKNOWN_COOKIE_MSG =
Message for UnknownCookieError
'No cookie named %s is registered'.freeze
- UnknownCookieError =
Class.new(Cookie::Error)
Class Method Summary collapse
Instance Method Summary collapse
- #fetch(name) ⇒ Object
- #get(name) ⇒ Object
-
#initialize(entries = EMPTY_HASH) ⇒ Registry
constructor
A new instance of Registry.
Constructor Details
#initialize(entries = EMPTY_HASH) ⇒ Registry
Returns a new instance of Registry.
30 31 32 |
# File 'lib/cookie/registry.rb', line 30 def initialize(entries = EMPTY_HASH) super end |
Class Method Details
.coerce(header) ⇒ Object
17 18 19 |
# File 'lib/cookie/registry.rb', line 17 def self.coerce(header) new((header)) end |
Instance Method Details
#fetch(name) ⇒ Object
34 35 36 |
# File 'lib/cookie/registry.rb', line 34 def fetch(name) get(name) or raise UnknownCookieError, UNKNOWN_COOKIE_MSG % name.inspect end |
#get(name) ⇒ Object
38 39 40 |
# File 'lib/cookie/registry.rb', line 38 def get(name) @entries[name] end |