Class: SecureHeaders::XFrameOptions

Inherits:
Header
  • Object
show all
Includes:
Constants
Defined in:
lib/secure_headers/headers/x_frame_options.rb

Defined Under Namespace

Modules: Constants

Constant Summary

Constants included from Constants

Constants::CONFIG_KEY, Constants::DEFAULT_VALUE, Constants::VALID_XFO_HEADER, Constants::XFO_HEADER_NAME

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ XFrameOptions

Returns a new instance of XFrameOptions.



12
13
14
15
# File 'lib/secure_headers/headers/x_frame_options.rb', line 12

def initialize(config = nil)
  @config = config
  validate_config unless @config.nil?
end

Instance Method Details

#nameObject



17
18
19
# File 'lib/secure_headers/headers/x_frame_options.rb', line 17

def name
  XFO_HEADER_NAME
end

#valueObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/secure_headers/headers/x_frame_options.rb', line 21

def value
  case @config
  when NilClass
    DEFAULT_VALUE
  when String
    @config
  else
    @config[:value]
  end
end