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) ⇒ 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) ⇒ CacheControl
Returns a new instance of CacheControl.
39 40 41 |
# File 'lib/protocol/http/header/cache_control.rb', line 39 def initialize(value) super(value.downcase) end |
Instance Method Details
#<<(value) ⇒ Object
43 44 45 |
# File 'lib/protocol/http/header/cache_control.rb', line 43 def << value super(value.downcase) end |
#dynamic? ⇒ Boolean
51 52 53 |
# File 'lib/protocol/http/header/cache_control.rb', line 51 def dynamic? self.include?(DYNAMIC) end |
#max_age ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/protocol/http/header/cache_control.rb', line 75 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
67 68 69 |
# File 'lib/protocol/http/header/cache_control.rb', line 67 def no_cache? self.include?(NO_CACHE) end |
#no_store? ⇒ Boolean
71 72 73 |
# File 'lib/protocol/http/header/cache_control.rb', line 71 def no_store? self.include?(NO_STORE) end |
#private? ⇒ Boolean
59 60 61 |
# File 'lib/protocol/http/header/cache_control.rb', line 59 def private? self.include?(PRIVATE) end |
#public? ⇒ Boolean
63 64 65 |
# File 'lib/protocol/http/header/cache_control.rb', line 63 def public? self.include?(PUBLIC) end |
#static? ⇒ Boolean
47 48 49 |
# File 'lib/protocol/http/header/cache_control.rb', line 47 def static? self.include?(STATIC) end |
#streaming? ⇒ Boolean
55 56 57 |
# File 'lib/protocol/http/header/cache_control.rb', line 55 def streaming? self.include?(STREAMING) end |