mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +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
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(html_path, 'w') { |f| f.puts(doc.to_html) }
|
File.write(html_path, doc.to_html)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ class Blag
|
||||||
}.delete_if { |k, v| v.nil? }
|
}.delete_if { |k, v| v.nil? }
|
||||||
end
|
end
|
||||||
json = JSON.pretty_generate data
|
json = JSON.pretty_generate data
|
||||||
File.open(data_file, 'w') { |f| f.puts json }
|
File.write(data_file, json)
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_rss
|
def generate_rss
|
||||||
File.open(rss_file, 'w') { |f| f.puts feed_xml.target! }
|
File.write(rss_file, feed_xml.target!)
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_posts(n = @num_posts)
|
def latest_posts(n = @num_posts)
|
||||||
|
|
|
||||||
|
|
@ -368,9 +368,7 @@ class HarpBlog
|
||||||
puts ">>> write file '#{filename}', contents:"
|
puts ">>> write file '#{filename}', contents:"
|
||||||
puts data
|
puts data
|
||||||
else
|
else
|
||||||
File.open(filename, 'w') do |f|
|
File.write(filename, data)
|
||||||
f.puts(data)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue