Class: Shhh::App::Commands::OpenEditor
- Includes:
- Shhh
- Defined in:
- lib/shhh/app/commands/open_editor.rb
Constant Summary
Constants included from Shhh
Instance Attribute Summary collapse
-
#tempfile ⇒ Object
Returns the value of attribute tempfile.
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from Shhh::App::Commands::Command
Instance Attribute Details
#tempfile ⇒ Object
Returns the value of attribute tempfile.
19 20 21 |
# File 'lib/shhh/app/commands/open_editor.rb', line 19 def tempfile @tempfile end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/shhh/app/commands/open_editor.rb', line 21 def execute begin self.tempfile = ::Tempfile.new(::Base64.urlsafe_encode64(opts[:file])) decrypt_content(self.tempfile) result = process launch_editor ensure self.tempfile.close if tempfile self.tempfile.unlink rescue nil end result end |
#launch_editor ⇒ Object
34 35 36 |
# File 'lib/shhh/app/commands/open_editor.rb', line 34 def launch_editor system("#{application.editor} #{tempfile.path}") end |