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 64
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 71
def headers
  { HEADER => 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 79
def time
  Time.now + @amount.to_i
end