Class Pry::REPLFileLoader
In: lib/pry/repl_file_loader.rb
Parent: Object

A class to manage the loading of files through the REPL loop. This is an interesting trick as it processes your file as if it was user input in an interactive session. As a result, all Pry commands are available, and they are executed non-interactively. Furthermore the session becomes interactive when the repl loop processes a ‘make-interactive’ command in the file. The session also becomes interactive when an exception is encountered, enabling you to fix the error before returning to non-interactive processing with the ‘make-non-interactive’ command.

Methods

Public Class methods

Public Instance methods

Define a few extra commands useful for flipping back & forth between interactive/non-interactive modes

Switch to interactive mode, i.e take input from the user and use the regular print and exception handlers. @param [Pry] pry the Pry instance to make interactive.

Actually load the file through the REPL by setting file content as the REPL input stream.

Switch to non-interactive mode. Essentially this means there is no result output and that the session becomes interactive when an exception is encountered. @param [Pry] pry the Pry instance to make non-interactive.

[Validate]