Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
roktas committed Sep 12, 2024
1 parent 14f5d81 commit 1fc44fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions graphics/lib/sevgi/graphics/internal/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ def changed?(file, content, &filter)
Digest::SHA1.digest(old_content) != Digest::SHA1.digest(content)
end

def out(content, *paths, update: false, &filter)
def out(content, *paths, &filter)
if paths.empty?
::Kernel.puts(content)
else
file = ::File.expand_path(::File.join(*paths))
output = "#{content.chomp}\n"

::File.write(file, output) if !update || changed?(file, output, &filter)
file
return unless changed?(file, output, &filter)

file.tap { ::File.write(file, output) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion graphics/lib/sevgi/graphics/mixtures/save.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Save
EXT = ".svg"

def Out(*, **, &filter)
F.out(self.(**), *, update: true, &filter)
F.out(self.(**), *, &filter)
end

def Save(path = nil, default: nil, &filter)
Expand Down

0 comments on commit 1fc44fe

Please sign in to comment.