Class: Editor
- Inherits:
-
Executable
- Object
- Executable
- Editor
- Defined in:
- lib/devlogs/editor.rb
Overview
Wrapper for terminal editor
Class Method Summary collapse
-
.open(path) ⇒ Object
Opens the file at
path
using system editor.
Instance Method Summary collapse
-
#initialize ⇒ Editor
constructor
A new instance of Editor.
-
#open(path) ⇒ Object
Opens the file contained at the path.
Constructor Details
#initialize ⇒ Editor
Returns a new instance of Editor.
7 8 9 |
# File 'lib/devlogs/editor.rb', line 7 def initialize @program = ENV["EDITOR"] end |
Class Method Details
.open(path) ⇒ Object
Opens the file at path
using system editor
20 21 22 23 24 |
# File 'lib/devlogs/editor.rb', line 20 def open(path) session = new session.open(path) end |
Instance Method Details
#open(path) ⇒ Object
Opens the file contained at the path
12 13 14 15 16 |
# File 'lib/devlogs/editor.rb', line 12 def open(path) command = "#{@program} #{path}" system command end |