Sha256: bac85a7336579faffcaa53f193539f0a092a375de2f36d8a6db04aafa33d4583
Contents?: true
Size: 439 Bytes
Versions: 17
Compression:
Stored size: 439 Bytes
Contents
class File # Creates a new file, or overwrites an existing file, # and writes a string into it. Can also take a block # just like File#open, which is yielded _after_ the # string is writ. # # str = 'The content for the file' # File.create('myfile.txt', str) # # CREDIT: George Moschovitis def self.create(path, str='', &blk) open(path, 'wb') do |f| f << str blk.call(f) if blk end end end
Version data entries
17 entries across 16 versions & 2 rubygems