class Hanami::Config::Actions::Cookies

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.

@api public @since 2.0.0

Attributes

options[R]

Returns the cookie options.

@return [Hash]

@api public @since 2.0.0

Public Class Methods

new(options) click to toggle source

Returns a new ‘Cookies`.

You should not need to initialize this class directly. Instead use {Hanami::Config::Actions#cookies}.

@api private @since 2.0.0

# File lib/hanami/config/actions/cookies.rb, line 30
def initialize(options)
  @options = options
end

Public Instance Methods

enabled?() click to toggle source

Returns true if any cookie options have been provided.

@return [Boolean]

@api public @since 2.0.0

# File lib/hanami/config/actions/cookies.rb, line 40
def enabled?
  !options.nil?
end
to_h() click to toggle source

Returns the cookie options.

If no options have been provided, returns an empty hash.

@return [Hash]

@api public

# File lib/hanami/config/actions/cookies.rb, line 51
def to_h
  options.to_h
end