Sha256: 513f32ea615988680e09c33fbe86b71e1bb7ac8d3315eb826d55288fc95e1076
Contents?: true
Size: 628 Bytes
Versions: 10
Compression:
Stored size: 628 Bytes
Contents
class File # Writes the given array of data to the given path and closes the file. # This is done in binary mode, complementing <tt>IO.readlines</tt> in # standard Ruby. # # Note that +readlines+ (the standard Ruby method) returns an array of lines # <em>with newlines intact</em>, whereas +writelines+ uses +puts+, and so # appends newlines if necessary. In this small way, +readlines+ and # +writelines+ are not exact opposites. # # Returns +nil+. # # CREDIT: Noah Gibbs, Gavin Sinclair def self.writelines(path, data) File.open(path, "wb") do |file| file.puts(data) end end end
Version data entries
10 entries across 10 versions & 1 rubygems