class Hanami::Action::Cache::Expires::Directives

Class which stores Expires directives

@since 0.3.0 @api private

Public Class Methods

new(amount, *values) click to toggle source

@since 0.3.0 @api private

# File lib/hanami/action/cache/expires.rb, line 61
def initialize(amount, *values)
  @amount = amount
  @cache_control = Hanami::Action::Cache::CacheControl::Directives.new(*(values << {max_age: amount}))
end

Public Instance Methods

headers() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/action/cache/expires.rb, line 68
def headers
  {Action::EXPIRES => time.httpdate}.merge(@cache_control.headers)
end

Private Instance Methods

time() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/action/cache/expires.rb, line 76
def time
  Time.now + @amount.to_i
end