Class: Daily::Txt::System

Inherits:
Object
  • Object
show all
Defined in:
lib/daily/txt/system.rb

Constant Summary collapse

EDITOR_CANDIDATES =
[
  "vim",
  "vi",
  "emacs"
]

Class Method Summary collapse

Class Method Details

.exec(command_path, arg) ⇒ Object



30
31
32
# File 'lib/daily/txt/system.rb', line 30

def exec(command_path, arg)
  system(command_path, arg)
end

.find_editorObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/daily/txt/system.rb', line 19

def find_editor
  editors = []
  EDITOR_CANDIDATES.each do |candidate|
    found = Which.which(candidate)
    if found && !found.empty?
      editors = editors + found
    end
  end
  editors
end

.wait_input(question) ⇒ Object



14
15
16
17
# File 'lib/daily/txt/system.rb', line 14

def wait_input(question)
  print question
  return gets.chomp
end