class Artifact::WritableFile
Public Instance Methods
delete()
click to toggle source
# File lib/artifact.rb, line 340 def delete FileUtils.rm(full_path) end
save(new_content)
click to toggle source
# File lib/artifact.rb, line 323 def save(new_content) Artifact.ensure_dir!(@full_path) # File.open(@full_path, 'wb') { |f| f.write(content.gsub("\r\n", "\n")) } File.open(@full_path, 'wb') { |f| f.write(new_content) } @content = nil end
update(new_content, meta = nil)
click to toggle source
# File lib/artifact.rb, line 330 def update(new_content, meta = nil) if exists? and new_content == read return puts "No changes. No need to write changes to disk." end Artifact.run_hook :before_update, new_content, @full_path save(new_content) Artifact.run_hook :after_update, new_content, @full_path end