Class: Lotus::Action::Cache::Directives Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/lotus/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

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



68
69
70
71
72
73
74
75
76
77
# File 'lib/lotus/action/cache/directives.rb', line 68

def initialize(*values)
  @directives = []
  values.each do |directive_key|
    if directive_key.kind_of? 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.

Since:

  • 0.3.0



83
84
85
# File 'lib/lotus/action/cache/directives.rb', line 83

def <<(directive)
  @directives << directive if directive.valid?
end

#eachObject

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



79
80
81
# File 'lib/lotus/action/cache/directives.rb', line 79

def each
  @directives.each { |d| yield d }
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.

Since:

  • 0.3.0



93
94
95
# File 'lib/lotus/action/cache/directives.rb', line 93

def join(separator)
  values.join(separator)
end

#valuesObject

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



87
88
89
90
91
# File 'lib/lotus/action/cache/directives.rb', line 87

def values
  @directives.delete_if do |directive|
    directive.name == :public && @directives.map(&:name).include?(:private)
  end
end