class BabelDiff::FileHandler
Public Instance Methods
create_additions(content)
click to toggle source
# File lib/babel_diff/file_handler.rb, line 21 def create_additions(content) File.open(additions_file_path, "w+") do |f| f.write(content) end end
create_updates(content)
click to toggle source
# File lib/babel_diff/file_handler.rb, line 15 def create_updates(content) File.open(updates_file_path, "w+") do |f| f.write(content) end end
current_version()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 7 def current_version if File.exist?(current_version_path) File.read(current_version_path) else raise "Phrase file not found" end end
previous_version()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 3 def previous_version File.exist?(previous_version_path) ? File.read(previous_version_path) : "" end
version_files()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 27 def version_files current_contents = File.read(current_version_path) File.open(previous_version_path, "w+") do |f| f.write(current_contents) end end
Private Instance Methods
additions_file_path()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 44 def additions_file_path root_path + ".additions.yml" end
previous_version_path()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 36 def previous_version_path root_path + ".previous_version.yml" end
root_path()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 48 def root_path current_version_path.split(".")[0...-1].join(".") end
updates_file_path()
click to toggle source
# File lib/babel_diff/file_handler.rb, line 40 def updates_file_path root_path + ".updates.yml" end