Class: Hanami::Action::Cache::Directives Private
- Inherits:
-
Object
- Object
- Hanami::Action::Cache::Directives
- Includes:
- Enumerable
- 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.
Collection of value and non value directives
Instance Method Summary collapse
- #<<(directive) ⇒ Object private
- #each(&block) ⇒ Object private
-
#initialize(*values) ⇒ Directives
constructor
private
A new instance of Directives.
- #join(separator) ⇒ Object private
- #values ⇒ Object private
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.
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/hanami/action/cache/directives.rb', line 87 def initialize(*values) @directives = [] values.each do |directive_key| if directive_key.is_a? Hash directive_key.each { |name, value| self << ValueDirective.new(name, value) } else self << NonValueDirective.new(directive_key) end end end |
Instance Method Details
#<<(directive) ⇒ 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.
106 107 108 |
# File 'lib/hanami/action/cache/directives.rb', line 106 def <<(directive) @directives << directive if directive.valid? end |
#each(&block) ⇒ 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.
100 101 102 |
# File 'lib/hanami/action/cache/directives.rb', line 100 def each(&block) @directives.each(&block) end |
#join(separator) ⇒ 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.
120 121 122 |
# File 'lib/hanami/action/cache/directives.rb', line 120 def join(separator) values.join(separator) end |
#values ⇒ 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.
112 113 114 115 116 |
# File 'lib/hanami/action/cache/directives.rb', line 112 def values @directives.delete_if do |directive| directive.name == :public && @directives.map(&:name).include?(:private) end end |