Sha256: 0c4190ffe707acfe9be2e342ecd7315407cb4ce10496b066971af19688f09046

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

class Array

  # Writes the array as lines to the given file, and returns the array.
  # A new line character (<code>$/</code>) is written after each line.
  # The file is overwritten if it already exists.  Any necessary parent
  # directories are created if they do not exist.
  #
  # @param file [String, Pathname]
  # @return [Array]
  def write_to_file(file)
    file.to_pathname.write_lines(self)
    self
  end

  # Appends the array as lines to the given file, and returns the array.
  # A new line character (<code>$/</code>) is written after each line.
  # The file is created if it does not exist.  Any necessary parent
  # directories are created if they do not exist.
  #
  # @param file [String, Pathname]
  # @return [Array]
  def append_to_file(file)
    file.to_pathname.append_lines(self)
    self
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pleasant_path-1.0.0 lib/pleasant_path/array.rb