Class: Hanami::Action::Cache::NonValueDirective Private

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

ex: no-cache

Since:

  • 0.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ NonValueDirective

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

Since:

  • 0.3.0



78
79
80
# File 'lib/hanami/action/cache/directives.rb', line 78

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

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



74
75
76
# File 'lib/hanami/action/cache/directives.rb', line 74

def name
  @name
end

Instance Method Details

#to_strObject

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



84
85
86
# File 'lib/hanami/action/cache/directives.rb', line 84

def to_str
  @name.to_s.tr("_", "-")
end

#valid?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



90
91
92
# File 'lib/hanami/action/cache/directives.rb', line 90

def valid?
  NON_VALUE_DIRECTIVES.include?(@name)
end