Module: Edit

Defined in:
lib/edit.rb,
lib/edit/vim.rb,
lib/edit/mate.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_editorObject

Returns the value of attribute default_editor.



3
4
5
# File 'lib/edit.rb', line 3

def default_editor
  @default_editor
end

Class Method Details

.mate(path, line) ⇒ Object



2
3
4
# File 'lib/edit/mate.rb', line 2

def self.mate(path, line)
  system 'mate', path, '-l', line
end

.open(path, line = 0) ⇒ Object



5
6
7
8
9
10
# File 'lib/edit.rb', line 5

def open(path, line = 0)
  require "edit/#{default_editor}"
  self.send(default_editor.to_sym, path, line.to_s)
rescue LoadError
  puts "No Edit: #{default_editor}"
end

.vim(path, line = 0) ⇒ Object



2
3
4
# File 'lib/edit/vim.rb', line 2

def self.vim(path, line = 0)
  system 'vim', path, "+#{line}"
end