class Terrestrial::Cli::Editor::BaseEditor

Public Class Methods

add_import(file) click to toggle source
# File lib/terrestrial/cli/editor/base_editor.rb, line 12
def self.add_import(file)
  raise "Not implemented"
end
edit_file(path) { |line, line_number, temp_file| ... } click to toggle source
# File lib/terrestrial/cli/editor/base_editor.rb, line 16
def self.edit_file(path)
  temp_file = Tempfile.new(File.basename(path))
  begin
    line_number = 1
    File.open(path, 'r') do |file|
      file.each_line do |line|
        yield line, line_number, temp_file
        line_number += 1
      end
    end
    temp_file.close
    FileUtils.mv(temp_file.path, path)
  ensure
    temp_file.close
    temp_file.unlink
  end
end
find_and_edit_line(string_entry) click to toggle source
# File lib/terrestrial/cli/editor/base_editor.rb, line 8
def self.find_and_edit_line(string_entry)
  raise "Not implemented"
end