Class: HTTP::Security::Headers::XXSSProtection

Inherits:
Object
  • Object
show all
Defined in:
lib/http/security/headers/x_xss_protection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directives = {}) ⇒ XXSSProtection

Returns a new instance of XXSSProtection.



10
11
12
13
14
# File 'lib/http/security/headers/x_xss_protection.rb', line 10

def initialize(directives={})
  @enabled = directives[:enabled]
  @mode    = directives[:mode]
  @report  = directives[:report]
end

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



6
7
8
# File 'lib/http/security/headers/x_xss_protection.rb', line 6

def mode
  @mode
end

#reportObject (readonly)

Returns the value of attribute report.



8
9
10
# File 'lib/http/security/headers/x_xss_protection.rb', line 8

def report
  @report
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/http/security/headers/x_xss_protection.rb', line 16

def enabled?
  !!@enabled
end

#to_sObject



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

def to_s
  str = if @enabled then '1'
        else             '0'
        end

  str << "; mode=#{@mode}"     if @mode
  str << "; report=#{@report}" if @report

  return str
end