edge badge
Namespace
Methods
B
I
N
P
R
S
U
Attributes
[R] directives
Class Public methods
new()
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 141
def initialize
  @directives = {}
  yield self if block_given?
end
Instance Public methods
block_all_mixed_content(enabled = true)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 160
def block_all_mixed_content(enabled = true)
  if enabled
    @directives["block-all-mixed-content"] = true
  else
    @directives.delete("block-all-mixed-content")
  end
end
build(context = nil, nonce = nil)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 206
def build(context = nil, nonce = nil)
  build_directives(context, nonce).compact.join("; ")
end
initialize_copy(other)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 146
def initialize_copy(other)
  @directives = other.directives.deep_dup
end
plugin_types(*types)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 168
def plugin_types(*types)
  if types.first
    @directives["plugin-types"] = types
  else
    @directives.delete("plugin-types")
  end
end
report_uri(uri)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 176
def report_uri(uri)
  @directives["report-uri"] = [uri]
end
require_sri_for(*types)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 180
def require_sri_for(*types)
  if types.first
    @directives["require-sri-for"] = types
  else
    @directives.delete("require-sri-for")
  end
end
sandbox(*values)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 188
def sandbox(*values)
  if values.empty?
    @directives["sandbox"] = true
  elsif values.first
    @directives["sandbox"] = values
  else
    @directives.delete("sandbox")
  end
end
upgrade_insecure_requests(enabled = true)
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 198
def upgrade_insecure_requests(enabled = true)
  if enabled
    @directives["upgrade-insecure-requests"] = true
  else
    @directives.delete("upgrade-insecure-requests")
  end
end