Class: Cue::Command::Utils::Editor
- Inherits:
-
Object
- Object
- Cue::Command::Utils::Editor
- Defined in:
- lib/cue/command/utils/editor.rb
Instance Method Summary collapse
Instance Method Details
#basename ⇒ Object
7 8 9 |
# File 'lib/cue/command/utils/editor.rb', line 7 def basename 'cue' end |
#command ⇒ Object
11 12 13 |
# File 'lib/cue/command/utils/editor.rb', line 11 def command ENV['EDITOR'] || default_editor end |
#dir ⇒ Object
24 25 26 |
# File 'lib/cue/command/utils/editor.rb', line 24 def dir '/tmp' end |
#path ⇒ Object
28 29 30 |
# File 'lib/cue/command/utils/editor.rb', line 28 def path @path ||= File.(Dir::Tmpname::make_tmpname(basename, nil), dir) end |
#read ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/cue/command/utils/editor.rb', line 15 def read Process.wait(spawn([command, path].join(' '))) content = File.read(path) File.delete(path) content end |