Class: Hanami::Action::Cache::ETag Private

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

ETag value object

Since:

  • 0.3.0

Instance Method Summary collapse

Constructor Details

#initialize(env, value) ⇒ ETag

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 ETag.

Since:

  • 0.3.0



15
16
17
# File 'lib/hanami/action/cache/conditional_get.rb', line 15

def initialize(env, value)
  @env, @value = env, value
end

Instance Method Details

#fresh?Boolean

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:

  • (Boolean)

Since:

  • 0.3.0



21
22
23
# File 'lib/hanami/action/cache/conditional_get.rb', line 21

def fresh?
  none_match && @value == none_match
end

#headerObject

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



27
28
29
# File 'lib/hanami/action/cache/conditional_get.rb', line 27

def header
  {Action::ETAG => @value} if @value
end