Module: Hanami::Action::Cache::Expires Private

Defined in:
lib/hanami/action/cache/expires.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Module with Expires logic

Since:

  • 0.3.0

Defined Under Namespace

Modules: ClassMethods Classes: Directives

Constant Summary collapse

HEADER =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The HTTP header for Expires

Since:

  • 0.3.0

'Expires'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

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.

Since:

  • 0.3.0


19
20
21
22
23
24
# File 'lib/hanami/action/cache/expires.rb', line 19

def self.included(base)
  base.class_eval do
    extend ClassMethods
    @expires_directives = nil
  end
end

Instance Method Details

#finishObject

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.

Finalize the response including default cache headers into the response

See Also:

  • Hanami::Action#finish

Since:

  • 0.3.0


52
53
54
55
# File 'lib/hanami/action/cache/expires.rb', line 52

def finish
  super
  headers.merge!(self.class.expires_directives.headers) unless headers.include? HEADER
end