module Terrestrial::Cli::Editor

Public Class Methods

prepare_files(new_strings) click to toggle source
# File lib/terrestrial/cli/editor.rb, line 12
def prepare_files(new_strings)
  @new_strings = new_strings
  run
end

Private Class Methods

add_imports() click to toggle source
# File lib/terrestrial/cli/editor.rb, line 24
def add_imports
  @new_strings
    .uniq {|string| string.file}
    .each {|string| editor_for_type(string.file).add_import(string.file)}
end
editor_for_type(file) click to toggle source
# File lib/terrestrial/cli/editor.rb, line 36
def editor_for_type(file)
  EngineMapper.editor_for(File.extname(file))
end
run() click to toggle source
# File lib/terrestrial/cli/editor.rb, line 19
def run
  wrap_string_with_sdk_functions
  add_imports
end
wrap_string_with_sdk_functions() click to toggle source
# File lib/terrestrial/cli/editor.rb, line 30
def wrap_string_with_sdk_functions
  @new_strings.each do |string|
    editor_for_type(string.file).find_and_edit_line(string)
  end
end