Class: Lotus::Action::Cache::ValueDirective Private

Inherits:
Object
  • Object
show all
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.

Class representing value directives

ex: max-age=600

Since:

  • 0.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Since:

  • 0.3.0



26
27
28
# File 'lib/lotus/action/cache/directives.rb', line 26

def initialize(name, value)
  @name, @value = name, value
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



24
25
26
# File 'lib/lotus/action/cache/directives.rb', line 24

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



30
31
32
# File 'lib/lotus/action/cache/directives.rb', line 30

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.

Returns:

  • (Boolean)

Since:

  • 0.3.0



34
35
36
# File 'lib/lotus/action/cache/directives.rb', line 34

def valid?
  VALUE_DIRECTIVES.include? @name
end