Class: Rack::AcornCache::CacheControlHeader
- Inherits:
-
Object
- Object
- Rack::AcornCache::CacheControlHeader
- Defined in:
- lib/acorn_cache/cache_control_header.rb
Instance Attribute Summary collapse
-
#max_age ⇒ Object
Returns the value of attribute max_age.
-
#max_fresh ⇒ Object
Returns the value of attribute max_fresh.
-
#max_stale ⇒ Object
(also: #max_stale?)
Returns the value of attribute max_stale.
-
#must_revalidate ⇒ Object
(also: #must_revalidate?)
Returns the value of attribute must_revalidate.
-
#no_cache ⇒ Object
(also: #no_cache?)
Returns the value of attribute no_cache.
-
#no_store ⇒ Object
(also: #no_store?)
Returns the value of attribute no_store.
-
#private ⇒ Object
(also: #private?)
Returns the value of attribute private.
-
#s_maxage ⇒ Object
Returns the value of attribute s_maxage.
Instance Method Summary collapse
-
#initialize(header_string = "") ⇒ CacheControlHeader
constructor
A new instance of CacheControlHeader.
- #to_s ⇒ Object
Constructor Details
#initialize(header_string = "") ⇒ CacheControlHeader
Returns a new instance of CacheControlHeader.
8 9 10 11 |
# File 'lib/acorn_cache/cache_control_header.rb', line 8 def initialize(header_string = "") return unless header_string && !header_string.empty? set_directive_instance_variables!(header_string) end |
Instance Attribute Details
#max_age ⇒ Object
Returns the value of attribute max_age.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def max_age @max_age end |
#max_fresh ⇒ Object
Returns the value of attribute max_fresh.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def max_fresh @max_fresh end |
#max_stale ⇒ Object Also known as: max_stale?
Returns the value of attribute max_stale.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def max_stale @max_stale end |
#must_revalidate ⇒ Object Also known as: must_revalidate?
Returns the value of attribute must_revalidate.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def must_revalidate @must_revalidate end |
#no_cache ⇒ Object Also known as: no_cache?
Returns the value of attribute no_cache.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def no_cache @no_cache end |
#no_store ⇒ Object Also known as: no_store?
Returns the value of attribute no_store.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def no_store @no_store end |
#private ⇒ Object Also known as: private?
Returns the value of attribute private.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def private @private end |
#s_maxage ⇒ Object
Returns the value of attribute s_maxage.
5 6 7 |
# File 'lib/acorn_cache/cache_control_header.rb', line 5 def s_maxage @s_maxage end |
Instance Method Details
#to_s ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/acorn_cache/cache_control_header.rb', line 19 def to_s instance_variables.map do |ivar| directive = ivar.to_s.sub("@", "").sub("_", "-") value = instance_variable_get(ivar) next directive if value == true next unless value "#{directive}=#{value}" end.compact.sort.join(", ") end |