Module: Corrupted
- Defined in:
- lib/corrupted.rb,
lib/corrupted/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.create(name, extension, size = 64) ⇒ Object
name: The name of the file to create extension: The extension of the file to create size [optional]: The size (in kilobytes) of the file to create.
Class Method Details
.create(name, extension, size = 64) ⇒ Object
name: The name of the file to create extension: The extension of the file to create size [optional]: The size (in kilobytes) of the file to create
9 10 11 12 13 14 15 16 17 |
# File 'lib/corrupted.rb', line 9 def self.create name, extension, size=64 if File.exist?("#{name}.#{extension}") puts "File alredy exists :(" else File.open "#{name}.#{extension}", "w" do |f| f.puts Random.new.bytes(size*1000) #convert kilobytes to bytes end end end |