Sha256: dc71795467ec55c5f456bedce80a1d6cec4be9b2f12ff972be2e895f956a2ccf

Contents?: true

Size: 405 Bytes

Versions: 23

Compression:

Stored size: 405 Bytes

Contents

module SugarHigh
  module FileMutate
    module OverwriteContent      
      def overwrite content=nil, &block           
        File.overwrite self.path, content, &block
      end

      module ClassMethods
        def overwrite file, content=nil, &block
          File.open(get_filepath(file).path, 'w') do |f|
            f.puts content ||= yield
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
sugar-high-0.4.4.1 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.4 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.3 lib/sugar-high/file_mutate/overwrite_content.rb