Sha256: eb24e2ed260736f96f966b9af71593426ade578db06f50e7d0e82d039f0ccfe9
Contents?: true
Size: 783 Bytes
Versions: 14
Compression:
Stored size: 783 Bytes
Contents
module SecureHeaders class XDOBuildError < StandardError; end class XDownloadOptions < Header module Constants XDO_HEADER_NAME = "X-Download-Options" DEFAULT_VALUE = 'noopen' end include Constants def initialize(config = nil) @config = config validate_config unless @config.nil? end def name XDO_HEADER_NAME end def value case @config when NilClass DEFAULT_VALUE when String @config else @config[:value] end end private def validate_config value = @config.is_a?(Hash) ? @config[:value] : @config unless value.casecmp(DEFAULT_VALUE) == 0 raise XDOBuildError.new("Value can only be nil or 'noopen'") end end end end
Version data entries
14 entries across 14 versions & 1 rubygems