mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
use File.write instead of File.open for simple writes
This commit is contained in:
parent
5949cf20bd
commit
01a7ad64d7
3 changed files with 4 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ class CSSInliner
|
|||
end
|
||||
end
|
||||
|
||||
File.open(html_path, 'w') { |f| f.puts(doc.to_html) }
|
||||
File.write(html_path, doc.to_html)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ class Blag
|
|||
}.delete_if { |k, v| v.nil? }
|
||||
end
|
||||
json = JSON.pretty_generate data
|
||||
File.open(data_file, 'w') { |f| f.puts json }
|
||||
File.write(data_file, json)
|
||||
end
|
||||
|
||||
def generate_rss
|
||||
File.open(rss_file, 'w') { |f| f.puts feed_xml.target! }
|
||||
File.write(rss_file, feed_xml.target!)
|
||||
end
|
||||
|
||||
def latest_posts(n = @num_posts)
|
||||
|
|
|
|||
|
|
@ -368,9 +368,7 @@ class HarpBlog
|
|||
puts ">>> write file '#{filename}', contents:"
|
||||
puts data
|
||||
else
|
||||
File.open(filename, 'w') do |f|
|
||||
f.puts(data)
|
||||
end
|
||||
File.write(filename, data)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue