Class: Sym::App::Commands::OpenEditor
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Sym::App::Commands::OpenEditor
- Includes:
- Sym
- Defined in:
- lib/sym/app/commands/open_editor.rb
Constant Summary
Constants included from Sym
Instance Attribute Summary collapse
-
#tempfile ⇒ Object
Returns the value of attribute tempfile.
Instance Method Summary collapse
Methods included from Sym
config, default_key, default_key?, default_key_file
Constructor Details
This class inherits a constructor from Sym::App::Commands::BaseCommand
Instance Attribute Details
#tempfile ⇒ Object
Returns the value of attribute tempfile.
19 20 21 |
# File 'lib/sym/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/sym/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/sym/app/commands/open_editor.rb', line 34 def launch_editor system("#{application.editor} #{tempfile.path}") end |