Sha256: 1ce6899e3bb2266dff7dfffe8b56e6fe0454456631574d3fb6243ae6dc6e07b9

Contents?: true

Size: 309 Bytes

Versions: 2

Compression:

Stored size: 309 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
file_mutate-0.1.3 lib/file_mutate/append_content.rb
file_mutate-0.1.2 lib/file_mutate/append_content.rb