Class: Hanami::Action::Cache::CacheControl::Directives Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/action/cache/cache_control.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.

Class which stores CacheControl values

Since:

  • 0.3.0

Instance Method Summary collapse

Constructor Details

#initialize(*values) ⇒ Directives

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.

Returns a new instance of Directives.

Since:

  • 0.3.0


64
65
66
# File 'lib/hanami/action/cache/cache_control.rb', line 64

def initialize(*values)
  @directives = Hanami::Action::Cache::Directives.new(*values)
end

Instance Method Details

#headersObject

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


70
71
72
73
74
75
76
# File 'lib/hanami/action/cache/cache_control.rb', line 70

def headers
  if @directives.any?
    { HEADER => @directives.join(', ') }
  else
    {}
  end
end