Method: Pry::Editor#build_editor_invocation_string

Defined in:
lib/pry/editor.rb

#build_editor_invocation_string(file, line, blocking) ⇒ Object

Generate the string that’s used to start the editor. This includes all the flags we want as well as the file and line number we want to open at.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pry/editor.rb', line 60

def build_editor_invocation_string(file, line, blocking)
  if pry_instance.config.editor.respond_to?(:call)
    args = [file, line, blocking][0...(pry_instance.config.editor.arity)]
    pry_instance.config.editor.call(*args)
  else
    sanitized_file = Helpers::Platform.windows? ? file : Shellwords.escape(file)
    editor = pry_instance.config.editor
    flag = blocking_flag_for_editor(blocking)
    start_line = start_line_syntax_for_editor(sanitized_file, line)
    "#{editor} #{flag} #{start_line}"
  end
end