Class: HTTP::Security::Headers::CacheControl
- Inherits:
-
Object
- Object
- HTTP::Security::Headers::CacheControl
- Defined in:
- lib/http/security/headers/cache_control.rb
Instance Attribute Summary collapse
-
#max_age ⇒ Object
readonly
Returns the value of attribute max_age.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CacheControl
constructor
A new instance of CacheControl.
- #no_cache? ⇒ Boolean
- #private? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CacheControl
8 9 10 11 12 |
# File 'lib/http/security/headers/cache_control.rb', line 8 def initialize(={}) @private = [:private] @max_age = [:max_age] @no_cache = [:no_cache] end |
Instance Attribute Details
#max_age ⇒ Object (readonly)
Returns the value of attribute max_age.
6 7 8 |
# File 'lib/http/security/headers/cache_control.rb', line 6 def max_age @max_age end |
Instance Method Details
#no_cache? ⇒ Boolean
18 19 20 |
# File 'lib/http/security/headers/cache_control.rb', line 18 def no_cache? !!@no_cache end |
#private? ⇒ Boolean
14 15 16 |
# File 'lib/http/security/headers/cache_control.rb', line 14 def private? !!@private end |
#to_s ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/http/security/headers/cache_control.rb', line 22 def to_s directives = [] directives << "private" if @private directives << "max-age=#{@max_age}" if @max_age directives << "no-cache" if @no_cache return directives.join(', ') end |