Class: Hanami::Config::Actions::Cookies
- Inherits:
-
Object
- Object
- Hanami::Config::Actions::Cookies
- Defined in:
- lib/hanami/config/actions/cookies.rb
Overview
Wrapper for app-level config of HTTP cookies for Hanami actions.
This decorates the hash of cookie options that is otherwise directly configurable on actions, and adds the ‘enabled?` method to allow app base action to determine whether to include the `Action::Cookies` module.
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Returns the cookie options.
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Returns true if any cookie options have been provided.
-
#initialize(options) ⇒ Cookies
constructor
private
Returns a new ‘Cookies`.
-
#to_h ⇒ Hash
Returns the cookie options.
Constructor Details
#initialize(options) ⇒ Cookies
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new ‘Cookies`.
You should not need to initialize this class directly. Instead use Hanami::Config::Actions#cookies.
30 31 32 |
# File 'lib/hanami/config/actions/cookies.rb', line 30 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns the cookie options.
21 22 23 |
# File 'lib/hanami/config/actions/cookies.rb', line 21 def @options end |
Instance Method Details
#enabled? ⇒ Boolean
Returns true if any cookie options have been provided.
40 41 42 |
# File 'lib/hanami/config/actions/cookies.rb', line 40 def enabled? !.nil? end |
#to_h ⇒ Hash
Returns the cookie options.
If no options have been provided, returns an empty hash.
51 52 53 |
# File 'lib/hanami/config/actions/cookies.rb', line 51 def to_h .to_h end |