Class: Rack::CookieMonsterConfig
- Inherits:
-
Object
- Object
- Rack::CookieMonsterConfig
- Defined in:
- lib/rack/cookie_monster.rb
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#snackers ⇒ Object
readonly
Returns the value of attribute snackers.
Instance Method Summary collapse
- #eat(cookie) ⇒ Object
-
#initialize(opts = {}) ⇒ CookieMonsterConfig
constructor
A new instance of CookieMonsterConfig.
- #share_with(snacker) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ CookieMonsterConfig
Returns a new instance of CookieMonsterConfig.
92 93 94 95 |
# File 'lib/rack/cookie_monster.rb', line 92 def initialize(opts={}) = [opts[:cookies]].compact.flatten.map { |x| x.to_sym } @snackers = [opts[:share_with]].compact.flatten end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
90 91 92 |
# File 'lib/rack/cookie_monster.rb', line 90 def end |
#snackers ⇒ Object (readonly)
Returns the value of attribute snackers.
90 91 92 |
# File 'lib/rack/cookie_monster.rb', line 90 def snackers @snackers end |
Instance Method Details
#eat(cookie) ⇒ Object
97 98 99 |
# File 'lib/rack/cookie_monster.rb', line 97 def eat() << .to_sym end |
#share_with(snacker) ⇒ Object
101 102 103 |
# File 'lib/rack/cookie_monster.rb', line 101 def share_with(snacker) @snackers << snacker end |