Class: Hanami::Config::Cookies Private
- Inherits:
-
Object
- Object
- Hanami::Config::Cookies
- Defined in:
- lib/hanami/config/cookies.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Cookies configuration
Instance Attribute Summary collapse
-
#default_options ⇒ Hash
readonly
private
Return the routes for this application.
Instance Method Summary collapse
-
#enabled? ⇒ TrueClass, FalseClass
private
Return if cookies are enabled.
-
#initialize(configuration, options = {}) ⇒ Cookies
constructor
private
Cookies configuration.
Constructor Details
#initialize(configuration, 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.
Cookies configuration
httponly option enabled by default. Prevent attackers to steal cookies via JavaScript, Eg. alert(document.cookie) will fail
52 53 54 55 56 |
# File 'lib/hanami/config/cookies.rb', line 52 def initialize(configuration, = {}) @options = @default_options = { httponly: true, secure: configuration.ssl? } @default_options.merge!() if .is_a?(::Hash) end |
Instance Attribute Details
#default_options ⇒ Hash (readonly)
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.
Return the routes for this application
16 17 18 |
# File 'lib/hanami/config/cookies.rb', line 16 def @default_options end |
Instance Method Details
#enabled? ⇒ TrueClass, FalseClass
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.
Return if cookies are enabled
64 65 66 |
# File 'lib/hanami/config/cookies.rb', line 64 def enabled? @options.respond_to?(:empty?) ? !@options.empty? : !!@options end |