Sha256: e8b8ce7f87cda7ced21f2eae4fd4339a6c10a584ef4f4a63fea1b475e6b89433

Contents?: true

Size: 358 Bytes

Versions: 23

Compression:

Stored size: 358 Bytes

Contents

module SugarHigh
  module FileMutate
    module AppendContent
      def append content=nil, &block
        File.append self.path, content, &block
      end

      module ClassMethods
        def append path, content=nil, &block
          File.open(path, 'a') 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/append_content.rb
sugar-high-0.4.4 lib/sugar-high/file_mutate/append_content.rb
sugar-high-0.4.3 lib/sugar-high/file_mutate/append_content.rb