Class: File
Constant Summary collapse
- DIRECTOY_SEPARTOR =
Windows vs. *nix directory separator.
RUBY_PLATFORM =~ /win32/ ? '\\' : '/'
Class Method Summary collapse
-
.write(filename, contents) ⇒ Object
Shortcut for quickly writing to a file.
Class Method Details
.write(filename, contents) ⇒ Object
Shortcut for quickly writing to a file.
Example: File.write('foo.txt', 'rawr') #=> 4
Returns: Bytes written
11 12 13 |
# File 'lib/extra/file.rb', line 11 def self.write(filename, contents) File.open(filename, 'w') { |f| f.write(contents) } end |