module Jekyll::JekyllContentSecurityPolicyGenerator

Public Instance Methods

write(dest) click to toggle source

Write document contents

# File lib/jekyll-content-security-policy-generator/hook.rb, line 262
def write(dest)
  dest_path = destination(dest)

  if File.extname(dest_path) == ".html"
    content_security_policy_generator = ContentSecurityPolicyGenerator.new output
    self.write_file_contents(dest_path, content_security_policy_generator.run)
  else
    self.write_file_contents(dest_path, output)
  end

end
write_file_contents(dest, content) click to toggle source

Write the file contents back.

# File lib/jekyll-content-security-policy-generator/hook.rb, line 253
def write_file_contents(dest, content)
  FileUtils.mkdir_p(File.dirname(dest))
  File.open(dest, 'w') do |f|
    f.write(content)
  end
end