Class: SecureHeaders::XDownloadOptions

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

Defined Under Namespace

Modules: Constants

Constant Summary

Constants included from Constants

Constants::CONFIG_KEY, Constants::DEFAULT_VALUE, Constants::XDO_HEADER_NAME

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ XDownloadOptions

Returns a new instance of XDownloadOptions.



11
12
13
14
# File 'lib/secure_headers/headers/x_download_options.rb', line 11

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

Instance Method Details

#nameObject



16
17
18
# File 'lib/secure_headers/headers/x_download_options.rb', line 16

def name
  XDO_HEADER_NAME
end

#valueObject



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

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