class Pry::REPL

def read

Returns:
  • (:no_more_input) - On EOF.
  • (:control_c) - On ``.
  • (nil) - On ``.
  • (String) - The line entered by the user.
def read
  @indent.reset if pry.eval_string.empty?
  current_prompt = pry.select_prompt
  indentation = pry.config.auto_indent ? @indent.current_prefix : ''
  val = read_line("#{current_prompt}#{indentation}")
  # Return nil for EOF, :no_more_input for error, or :control_c for <Ctrl-C>
  return val unless val.is_a?(String)
  if pry.config.auto_indent && !input_multiline?
    original_val = "#{indentation}#{val}"
    indented_val = @indent.indent(val)
    if output.tty? &&
       pry.config.correct_indent &&
       Pry::Helpers::BaseHelpers.use_ansi_codes?
      output.print @indent.correct_indentation(
        current_prompt,
        indented_val,
        calculate_overhang(current_prompt, original_val, indented_val)
      )
      output.flush
    end
  else
    indented_val = val
  end
  indented_val
end