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.5.5 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.5.4 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.5.3 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.5.1 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.5.0 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.9.5 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.9.3 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.9.2 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.9.1 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.9 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.8 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.7 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.6.4 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.6.3 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.6.2 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.6.1 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.6 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.5.2 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.5 lib/sugar-high/file_mutate/overwrite_content.rb
sugar-high-0.4.4.2 lib/sugar-high/file_mutate/overwrite_content.rb