module Rsummary::FileUtil
Constants
- DIR_PATH
- FILE_NAME
Public Instance Methods
delete_file()
click to toggle source
# File lib/rsummary/file_util.rb, line 36 def delete_file File.delete(DIR_PATH + FILE_NAME) if file_exists? end
file_exists?()
click to toggle source
# File lib/rsummary/file_util.rb, line 22 def file_exists? File.exist?(DIR_PATH + FILE_NAME) end
load_json()
click to toggle source
# File lib/rsummary/file_util.rb, line 14 def load_json if file_exists? open(DIR_PATH + FILE_NAME) do |io| JSON.load(io) end end end
make_dir()
click to toggle source
# File lib/rsummary/file_util.rb, line 26 def make_dir FileUtils.mkdir_p(DIR_PATH) unless FileTest.exist?(DIR_PATH) end
save_to_file(result)
click to toggle source
# File lib/rsummary/file_util.rb, line 9 def save_to_file(result) make_dir write_to_file(result) end
write_to_file(result)
click to toggle source
# File lib/rsummary/file_util.rb, line 30 def write_to_file(result) File.open(DIR_PATH + FILE_NAME, "w") do |f| f.puts(result) end end