class Pry::Editor

Public Class Methods

edit_tempfile_with_content(initial_content, line=1) click to toggle source
# File lib/pry/editor.rb, line 7
def edit_tempfile_with_content(initial_content, line=1)
  temp_file do |f|
    f.puts(initial_content)
    f.flush
    f.close(false)
    invoke_editor(f.path, line, true)
    File.read(f.path)
  end
end
invoke_editor(file, line, blocking=true) click to toggle source
# File lib/pry/editor.rb, line 17
def invoke_editor(file, line, blocking=true)
  raise CommandError, "Please set Pry.config.editor or export $VISUAL or $EDITOR" unless Pry.config.editor

  editor_invocation = build_editor_invocation_string(file, line, blocking)
  return nil unless editor_invocation

  if jruby?
    open_editor_on_jruby(editor_invocation)
  else
    open_editor(editor_invocation)
  end
end