Class: File

Inherits:
Object show all
Defined in:
lib/extra/file.rb

Constant Summary collapse

DIRECTOY_SEPARTOR =

Windows vs. *nix directory separator.

RUBY_PLATFORM =~ /win32/ ? '\\' : '/'

Class Method Summary collapse

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