Class: HTTP::Security::Headers::StrictTransportSecurity
- Inherits:
-
Object
- Object
- HTTP::Security::Headers::StrictTransportSecurity
- Defined in:
- lib/http/security/headers/strict_transport_security.rb
Instance Attribute Summary collapse
-
#max_age ⇒ Object
readonly
Returns the value of attribute max_age.
Instance Method Summary collapse
- #include_sub_domains? ⇒ Boolean
-
#initialize(directives = {}) ⇒ StrictTransportSecurity
constructor
A new instance of StrictTransportSecurity.
- #to_s ⇒ Object
Constructor Details
#initialize(directives = {}) ⇒ StrictTransportSecurity
Returns a new instance of StrictTransportSecurity.
8 9 10 11 |
# File 'lib/http/security/headers/strict_transport_security.rb', line 8 def initialize(directives={}) @max_age = directives[:max_age] @include_sub_domains = directives[:includesubdomains] end |
Instance Attribute Details
#max_age ⇒ Object (readonly)
Returns the value of attribute max_age.
6 7 8 |
# File 'lib/http/security/headers/strict_transport_security.rb', line 6 def max_age @max_age end |
Instance Method Details
#include_sub_domains? ⇒ Boolean
13 14 15 |
# File 'lib/http/security/headers/strict_transport_security.rb', line 13 def include_sub_domains? !!@include_sub_domains end |
#to_s ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/http/security/headers/strict_transport_security.rb', line 17 def to_s directives = [] directives << "max-age=#{@max_age}" if @max_age directives << "includeSubDomains" if @include_sub_domains return directives.join('; ') end |