Class: RobotVim::ScriptFile

Inherits:
Object
  • Object
show all
Defined in:
lib/robot-vim/script_file.rb

Class Method Summary collapse

Class Method Details

.open(commands) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/robot-vim/script_file.rb', line 4

def self.open(commands)
  file_name = FileNameGenerator.generate
  script_file = File.new(file_name, "w")
  script_file << commands
  script_file.flush
  script_file.close
  yield file_name
ensure
  File.delete(file_name) if File.exists?(file_name)
end