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
262 263 264 265 266 267 268 269 270 271 272 |
# 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) ⇒ Object
Write the file contents back.
253 254 255 256 257 258 |
# 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 |