Module: Jekyll::JekyllContentSecurityPolicyGenerator
Defined Under Namespace
Classes: ContentSecurityPolicyGenerator
Instance Method Summary collapse
-
#write(dest) ⇒ Object
Write document contents.
-
#write_file_contents(dest, content) ⇒ Object
Write the file contents back.
Instance Method Details
#write(dest) ⇒ Object
Write document contents
258 259 260 261 262 263 264 265 266 |
# File 'lib/jekyll-content-security-policy-generator/hook.rb', line 258 def write(dest) dest_path = destination(dest) if File.extname(dest_path) == ".html" content_security_policy_generator = ContentSecurityPolicyGenerator.new output output = content_security_policy_generator.run end write_file_contents(dest_path, output) end |
#write_file_contents(dest, content) ⇒ Object
Write the file contents back.
249 250 251 252 253 254 |
# File 'lib/jekyll-content-security-policy-generator/hook.rb', line 249 def write_file_contents(dest, content) FileUtils.mkdir_p(File.dirname(dest)) File.open(dest, 'w') do |f| f.write(content) end end |