Class: Flip::CookieStrategy
- Inherits:
-
AbstractStrategy
- Object
- AbstractStrategy
- Flip::CookieStrategy
- Defined in:
- lib/flip/cookie_strategy.rb
Defined Under Namespace
Modules: Loader
Class Method Summary collapse
Instance Method Summary collapse
- #cookie_name(definition) ⇒ Object
- #delete!(key) ⇒ Object
- #description ⇒ Object
- #knows?(definition) ⇒ Boolean
- #on?(definition) ⇒ Boolean
- #switch!(key, on) ⇒ Object
- #switchable? ⇒ Boolean
Methods inherited from AbstractStrategy
Class Method Details
.cookies=(cookies) ⇒ Object
34 35 36 |
# File 'lib/flip/cookie_strategy.rb', line 34 def self. @cookies = end |
Instance Method Details
#cookie_name(definition) ⇒ Object
38 39 40 41 |
# File 'lib/flip/cookie_strategy.rb', line 38 def (definition) definition = definition.key unless definition.is_a? Symbol "flip_#{definition}" end |
#delete!(key) ⇒ Object
30 31 32 |
# File 'lib/flip/cookie_strategy.rb', line 30 def delete! key .delete (key) end |
#description ⇒ Object
5 6 7 |
# File 'lib/flip/cookie_strategy.rb', line 5 def description "Uses cookies to apply only to your session." end |
#knows?(definition) ⇒ Boolean
9 10 11 |
# File 'lib/flip/cookie_strategy.rb', line 9 def knows? definition .key? (definition) end |
#on?(definition) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/flip/cookie_strategy.rb', line 13 def on? definition = [(definition)] = .is_a?(Hash) ? ['value'] : === 'true' end |
#switch!(key, on) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/flip/cookie_strategy.rb', line 23 def switch! key, on [(key)] = { 'value' => (on ? "true" : "false"), 'domain' => :all } end |
#switchable? ⇒ Boolean
19 20 21 |
# File 'lib/flip/cookie_strategy.rb', line 19 def switchable? true end |