Class: ElVfs::Command::CreateFile

Inherits:
ElVfs::Command show all
Defined in:
lib/el_finder_api/el_vfs/command/create_file.rb

Defined Under Namespace

Classes: Arguments, Result

Instance Attribute Summary

Attributes inherited from ElVfs::Command

#arguments, #error, #result

Instance Method Summary collapse

Methods inherited from ElVfs::Command

#headers, #initialize, #run

Methods inherited from Model

#attributes=, #el_hash, #initialize, options, #to_el_hash

Constructor Details

This class inherits a constructor from ElVfs::Command

Instance Method Details

#execute_commandObject



17
18
19
20
21
22
# File 'lib/el_finder_api/el_vfs/command/create_file.rb', line 17

def execute_command
  ElVfs::File.new(:parent => arguments.entry).tap do | file |
    Dir.mktmpdir{|dir| file.entry = ::File.open("#{dir}/#{arguments.name}", "w") }
    file.save!
  end
end