module Rockstart::Generators::ContentSecurityOptions

Adds options for managing a content security policy

Protected Instance Methods

content_security_flags() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 29
def content_security_flags
  {
    "--font_hosts" => font_hosts,
    "--image_hosts" => image_hosts,
    "--script_hosts" => script_hosts,
    "--style_hosts" => style_hosts
  }.compact.map do |k, v|
    [k, v] if v.present?
  end.compact
end
content_security_options() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 40
def content_security_options
  content_security_flags.flatten
end
font_hosts() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 44
def font_hosts
  options[:font_hosts] || []
end
image_hosts() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 48
def image_hosts
  options[:image_hosts] || []
end
script_hosts() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 52
def script_hosts
  options[:script_hosts] || []
end
style_hosts() click to toggle source
# File lib/rockstart/generators/content_security_options.rb, line 56
def style_hosts
  options[:style_hosts] || []
end