class Timesheets::Commands::Edit
Public Instance Methods
run()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 4 def run exec("#{editor} #{filepath}") end
Private Instance Methods
editor()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 10 def editor env_editor || git_editor || 'vim' end
env_editor()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 14 def env_editor env_editor_set? && env_editor_name end
env_editor_name()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 22 def env_editor_name ENV['EDITOR'].to_s end
env_editor_set?()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 18 def env_editor_set? env_editor_name.length > 0 end
git?()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 30 def git? %x[which git].length > 0 end
git_editor()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 26 def git_editor git? && git_editor_set? && git_editor_name end
git_editor_name()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 38 def git_editor_name %x[git config core.editor] end
git_editor_set?()
click to toggle source
# File lib/timesheets/commands/edit.rb, line 34 def git_editor_set? git_editor_name.length > 0 end