Class: Protocol::HTTP::Header::CacheControl
- Defined in:
- lib/protocol/http/header/cache_control.rb
Overview
Header value which is split by newline charaters (e.g. cookies).
Constant Summary collapse
- PRIVATE =
'private'
- PUBLIC =
'public'
- NO_CACHE =
'no-cache'
- NO_STORE =
'no-store'
- MAX_AGE =
'max-age'
Constants inherited from Split
Instance Method Summary collapse
- #<<(value) ⇒ Object
-
#initialize(value) ⇒ CacheControl
constructor
A new instance of CacheControl.
- #max_age ⇒ Object
- #no_cache? ⇒ Boolean
- #no_store? ⇒ Boolean
- #private? ⇒ Boolean
- #public? ⇒ Boolean
Methods inherited from Split
Constructor Details
#initialize(value) ⇒ CacheControl
Returns a new instance of CacheControl.
36 37 38 |
# File 'lib/protocol/http/header/cache_control.rb', line 36 def initialize(value) super(value.downcase) end |
Instance Method Details
#<<(value) ⇒ Object
40 41 42 |
# File 'lib/protocol/http/header/cache_control.rb', line 40 def << value super(value.downcase) end |
#max_age ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/protocol/http/header/cache_control.rb', line 60 def max_age if value = self.find{|value| value.start_with?(MAX_AGE)} _, age = value.split('=', 2) return Integer(age) end end |
#no_cache? ⇒ Boolean
52 53 54 |
# File 'lib/protocol/http/header/cache_control.rb', line 52 def no_cache? self.include?(NO_CACHE) end |
#no_store? ⇒ Boolean
56 57 58 |
# File 'lib/protocol/http/header/cache_control.rb', line 56 def no_store? self.include?(NO_STORE) end |
#private? ⇒ Boolean
44 45 46 |
# File 'lib/protocol/http/header/cache_control.rb', line 44 def private? self.include?(PRIVATE) end |
#public? ⇒ Boolean
48 49 50 |
# File 'lib/protocol/http/header/cache_control.rb', line 48 def public? self.include?(PUBLIC) end |