Class: Protocol::HTTP::Header::CacheControl
- Defined in:
- lib/protocol/http/header/cache_control.rb
Constant Summary collapse
- PRIVATE =
'private'- PUBLIC =
'public'- NO_CACHE =
'no-cache'- NO_STORE =
'no-store'- MAX_AGE =
'max-age'- STATIC =
'static'- DYNAMIC =
'dynamic'- STREAMING =
'streaming'
Constants inherited from Split
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #dynamic? ⇒ Boolean
-
#initialize(value = nil) ⇒ CacheControl
constructor
A new instance of CacheControl.
- #max_age ⇒ Object
- #no_cache? ⇒ Boolean
- #no_store? ⇒ Boolean
- #private? ⇒ Boolean
- #public? ⇒ Boolean
- #static? ⇒ Boolean
- #streaming? ⇒ Boolean
Methods inherited from Split
Constructor Details
#initialize(value = nil) ⇒ CacheControl
Returns a new instance of CacheControl.
22 23 24 |
# File 'lib/protocol/http/header/cache_control.rb', line 22 def initialize(value = nil) super(value&.downcase) end |
Instance Method Details
#<<(value) ⇒ Object
26 27 28 |
# File 'lib/protocol/http/header/cache_control.rb', line 26 def << value super(value.downcase) end |
#dynamic? ⇒ Boolean
34 35 36 |
# File 'lib/protocol/http/header/cache_control.rb', line 34 def dynamic? self.include?(DYNAMIC) end |
#max_age ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/protocol/http/header/cache_control.rb', line 58 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
50 51 52 |
# File 'lib/protocol/http/header/cache_control.rb', line 50 def no_cache? self.include?(NO_CACHE) end |
#no_store? ⇒ Boolean
54 55 56 |
# File 'lib/protocol/http/header/cache_control.rb', line 54 def no_store? self.include?(NO_STORE) end |
#private? ⇒ Boolean
42 43 44 |
# File 'lib/protocol/http/header/cache_control.rb', line 42 def private? self.include?(PRIVATE) end |
#public? ⇒ Boolean
46 47 48 |
# File 'lib/protocol/http/header/cache_control.rb', line 46 def public? self.include?(PUBLIC) end |
#static? ⇒ Boolean
30 31 32 |
# File 'lib/protocol/http/header/cache_control.rb', line 30 def static? self.include?(STATIC) end |
#streaming? ⇒ Boolean
38 39 40 |
# File 'lib/protocol/http/header/cache_control.rb', line 38 def streaming? self.include?(STREAMING) end |