Class: Editor

Inherits:
Executable show all
Defined in:
lib/devlogs/editor.rb

Overview

Wrapper for terminal editor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEditor

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