Class: Hanami::Action::Cache::ValueDirective Private
- Inherits:
-
Object
- Object
- Hanami::Action::Cache::ValueDirective
- 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 value directives
ex: max-age=600
Instance Attribute Summary collapse
- #name ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(name, value) ⇒ ValueDirective
constructor
private
A new instance of ValueDirective.
- #to_str ⇒ Object private
- #valid? ⇒ Boolean private
Constructor Details
#initialize(name, value) ⇒ ValueDirective
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 ValueDirective.
31 32 33 |
# File 'lib/hanami/action/cache/directives.rb', line 31 def initialize(name, value) @name, @value = name, value end |
Instance Attribute Details
#name ⇒ Object (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.
27 28 29 |
# File 'lib/hanami/action/cache/directives.rb', line 27 def name @name end |
Instance Method Details
#to_str ⇒ 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.
37 38 39 |
# File 'lib/hanami/action/cache/directives.rb', line 37 def to_str "#{@name.to_s.tr('_', '-')}=#{@value.to_i}" 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.
43 44 45 |
# File 'lib/hanami/action/cache/directives.rb', line 43 def valid? VALUE_DIRECTIVES.include? @name end |