Method: Files.create

Defined in:
lib/files.rb

.create(options = default_options, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/files.rb', line 15

def self.create options = default_options, &block
  require 'tmpdir'
  require 'fileutils'

  name = options[:name]
  path = File.join(Dir::tmpdir, "#{name}_#{Time.now.to_i}_#{rand(1000)}")

  Files.new path, block, options
end