Sha256: 6923245f2b9d0310482e8bbea41077694d601ee82b40ffada33653d899468edb
Contents?: true
Size: 376 Bytes
Versions: 6
Compression:
Stored size: 376 Bytes
Contents
module Semmy module Files module_function def rewrite(path, update) content = File.binread(path) updated_content = update.call(content) File.open(path, 'wb') do |file| file.write(updated_content) end end def rewrite_all(glob, update) Dir.glob(glob) do |path| rewrite(path, update) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
semmy-1.2.0 | lib/semmy/files.rb |
semmy-1.1.0 | lib/semmy/files.rb |
semmy-1.0.2 | lib/semmy/files.rb |
semmy-1.0.1 | lib/semmy/files.rb |
semmy-1.0.0 | lib/semmy/files.rb |
semmy-0.4.0 | lib/semmy/files.rb |