Class: HTTP::Security::Headers::XFrameOptions
- Inherits:
-
Object
- Object
- HTTP::Security::Headers::XFrameOptions
- Defined in:
- lib/http/security/headers/x_frame_options.rb
Instance Attribute Summary collapse
-
#allow_from ⇒ Object
readonly
Returns the value of attribute allow_from.
Instance Method Summary collapse
- #allow_all? ⇒ Boolean
- #deny? ⇒ Boolean
-
#initialize(directives = {}) ⇒ XFrameOptions
constructor
A new instance of XFrameOptions.
- #same_origin? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(directives = {}) ⇒ XFrameOptions
Returns a new instance of XFrameOptions.
8 9 10 11 12 13 |
# File 'lib/http/security/headers/x_frame_options.rb', line 8 def initialize(directives={}) @deny = directives[:deny] @same_origin = directives[:sameorigin] @allow_from = directives[:allow_from] @allow_all = directives[:allowall] end |
Instance Attribute Details
#allow_from ⇒ Object (readonly)
Returns the value of attribute allow_from.
6 7 8 |
# File 'lib/http/security/headers/x_frame_options.rb', line 6 def allow_from @allow_from end |
Instance Method Details
#allow_all? ⇒ Boolean
23 24 25 |
# File 'lib/http/security/headers/x_frame_options.rb', line 23 def allow_all? !!@allow_all end |
#deny? ⇒ Boolean
15 16 17 |
# File 'lib/http/security/headers/x_frame_options.rb', line 15 def deny? !!@deny end |
#same_origin? ⇒ Boolean
19 20 21 |
# File 'lib/http/security/headers/x_frame_options.rb', line 19 def same_origin? !!@same_origin end |
#to_s ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/http/security/headers/x_frame_options.rb', line 27 def to_s if @deny then 'DENY' elsif @same_origin then 'SAMEORIGIN' elsif @allow_from then "ALLOW-FROM #{@allow_from}" elsif @allow_all then 'ALLOWALL' else '' end end |