Class: Pry::Config
Instance Attribute Summary (collapse)
-
- (Boolean) auto_indent
Whether or not code should be indented using Pry::Indent.
-
- (Boolean) collision_warning
Whether or not a warning will be displayed when a command name collides with a method/local in the current context.
-
- (Boolean) color
Toggle Pry color on and off.
-
- (String) command_prefix
A string that must precede all Pry commands (e.g., if command_prefix is set to "%", the "cd" command must be invoked as "%cd").
-
- (Pry::CommandBase) commands
Get/Set the object to use for commands by default by all Pry instances.
-
- (Proc) control_d_handler
The proc that manages ^D presses in the REPL.
-
- (Boolean) correct_indent
Whether or not indentation should be corrected after hitting enter.
-
- (Fixnum) default_window_size
The number of lines of context to show before and after exceptions, etc.
-
- (Boolean) disable_auto_reload
Determines whether to disable edit-method's auto-reloading behavior.
-
- (String, #call) editor
The default editor to use.
-
- (Proc) exception_handler
Pry.config.exception_handler is an option determining the exception handler object - the Proc responsible for dealing with exceptions raised by user input to the REPL.
-
- (Array) exception_whitelist
The classes of exception that will not be caught by Pry.
-
- (Hash) extra_sticky_locals
Additional sticky locals (to the standard ones) to use in Pry sessions.
-
- (OpenStruct) gist
Config option for gist.
-
- (OpenStruct) history
Config option for history.
-
- (Pry::Hooks) hooks
Get/Set the
Pry::Hooksinstance that defines Pry hooks used by default by all Pry instances. -
- (#readline) input
Get/Set the object to use for input by default by all Pry instances.
-
- (Array) input_stack
Get/Set the stack of input objects that a Pry instance switches to when its current input object encounters EOF.
-
- (Integer) memory_size
Amount of results that will be stored into out.
-
- (#puts) output
Get/Set the object to use for output by default by all Pry instances.
-
- (Boolean) pager
Toggle paging on and off.
-
- (OpenStruct) plugins
Config option for plugins: sub-options include:
plugins.strict_loading(Boolean) which toggles whether referring to a non-existent plugin should raise an exception (defaults tofalse). -
- (Proc) print
Get/Set the Proc to use for printing by default by all Pry instances.
-
- (Array<Proc>, Proc) prompt
Get the array of Procs (or single Proc) to be used for the prompts by default by all Pry instances.
-
- (Array<String>) requires
Ruby files to be required after loading any plugins.
-
- (Boolean) should_load_plugins
Determines whether plugins should be loaded.
-
- (Boolean) should_load_rc
Determines whether the rc file (~/.pryrc) should be loaded.
-
- (Boolean) should_load_requires
Determines whether to load files specified with the -r flag.
-
- (Boolean) should_trap_interrupts
Determines whether Pry should trap SIGINT and cause it to raise an Interrupt exception.
-
- (Proc) system
The proc that runs system commands The proc is passed the pry output object, the command string to eval, and a reference to the pry instance.
Instance Attribute Details
- (Boolean) auto_indent
Whether or not code should be indented using Pry::Indent.
200 201 202 |
# File 'lib/pry/config.rb', line 200 def auto_indent @auto_indent end |
- (Boolean) collision_warning
Whether or not a warning will be displayed when a command name collides with a method/local in the current context.
208 209 210 |
# File 'lib/pry/config.rb', line 208 def collision_warning @collision_warning end |
- (Boolean) color
Toggle Pry color on and off.
139 140 141 |
# File 'lib/pry/config.rb', line 139 def color @color end |
- (String) command_prefix
A string that must precede all Pry commands (e.g., if command_prefix is set to "%", the "cd" command must be invoked as "%cd").
136 137 138 |
# File 'lib/pry/config.rb', line 136 def command_prefix @command_prefix end |
- (Pry::CommandBase) commands
Get/Set the object to use for commands by default by all Pry instances.
37 38 39 |
# File 'lib/pry/config.rb', line 37 def commands @commands end |
- (Proc) control_d_handler
The proc that manages ^D presses in the REPL. The proc is passed the current eval_string and the current pry instance.
191 192 193 |
# File 'lib/pry/config.rb', line 191 def control_d_handler @control_d_handler end |
- (Boolean) correct_indent
Whether or not indentation should be corrected after hitting enter. This feature is not supported by all terminals.
204 205 206 |
# File 'lib/pry/config.rb', line 204 def correct_indent @correct_indent end |
- (Fixnum) default_window_size
The number of lines of context to show before and after exceptions, etc.
75 76 77 |
# File 'lib/pry/config.rb', line 75 def default_window_size @default_window_size end |
- (Boolean) disable_auto_reload
Determines whether to disable edit-method's auto-reloading behavior.
158 159 160 |
# File 'lib/pry/config.rb', line 158 def disable_auto_reload @disable_auto_reload end |
- (String, #call) editor
The default editor to use. Defaults to $VISUAL, $EDITOR, or a sensible fallback
for the platform.
If editor is a String then that string is used as the shell
command to invoke the editor. If editor is callable (e.g a
Proc) then file, line, and reloading are passed in as parameters and the
return value of that callable invocation is used as the exact
shell command to invoke the editor. reloading indicates whether Pry will be
reloading code after the shell command returns. Any or all of these parameters
can be omitted from the callable's signature.
131 132 133 |
# File 'lib/pry/config.rb', line 131 def editor @editor end |
- (Proc) exception_handler
Pry.config.exception_handler is an option determining the exception handler object - the Proc responsible for dealing with exceptions raised by user input to the REPL. Three parameters are passed to the exception handler Proc: these are (1) the output object for the current session, (2) the exception object that was raised inside the Pry session, and (3) a reference to the associated Pry instance.
64 65 66 |
# File 'lib/pry/config.rb', line 64 def exception_handler @exception_handler end |
- (Array) exception_whitelist
The classes of exception that will not be caught by Pry.
69 70 71 |
# File 'lib/pry/config.rb', line 69 def exception_whitelist @exception_whitelist end |
- (Hash) extra_sticky_locals
Additional sticky locals (to the standard ones) to use in Pry sessions.
226 227 228 |
# File 'lib/pry/config.rb', line 226 def extra_sticky_locals @extra_sticky_locals end |
- (OpenStruct) gist
Config option for gist.
sub-options include gist.inspecter,
gist.inspecter is a callable that defines how the expression output
will be displayed when using the gist -i command.
220 221 222 |
# File 'lib/pry/config.rb', line 220 def gist @gist end |
- (OpenStruct) history
Config option for history. sub-options include history.file, history.load, and history.save history.file is the file to save/load history to, e.g Pry.config.history.file = "~/.pry_history". history.should_load is a boolean that determines whether history will be loaded from history.file at session start. history.should_save is a boolean that determines whether history will be saved to history.file at session end.
175 176 177 |
# File 'lib/pry/config.rb', line 175 def history @history end |
- (Pry::Hooks) hooks
Get/Set the Pry::Hooks instance that defines Pry hooks used by default by all Pry
instances.
83 84 85 |
# File 'lib/pry/config.rb', line 83 def hooks @hooks end |
- (#readline) input
Get/Set the object to use for input by default by all Pry instances. Pry.config.input is an option determining the input object - the object from which Pry retrieves its lines of input. Pry accepts any object that implements the readline method. This includes IO objects, StringIO, Readline, File and custom objects.
14 15 16 |
# File 'lib/pry/config.rb', line 14 def input @input end |
- (Array) input_stack
Get/Set the stack of input objects that a Pry instance switches to when its current input object encounters EOF.
102 103 104 |
# File 'lib/pry/config.rb', line 102 def input_stack @input_stack end |
- (Integer) memory_size
Amount of results that will be stored into out
187 188 189 |
# File 'lib/pry/config.rb', line 187 def memory_size @memory_size end |
- (#puts) output
Get/Set the object to use for output by default by all Pry instances. Pry.config.output is an option determining the output object - the object to which Pry writes its output. Pry accepts any object that implements the puts method. This includes IO objects, StringIO, File and custom objects.
24 25 26 |
# File 'lib/pry/config.rb', line 24 def output @output end |
- (Boolean) pager
Toggle paging on and off.
142 143 144 |
# File 'lib/pry/config.rb', line 142 def pager @pager end |
- (OpenStruct) plugins
Config option for plugins:
sub-options include:
plugins.strict_loading (Boolean) which toggles whether referring to a non-existent plugin should raise an exception (defaults to false)
181 182 183 |
# File 'lib/pry/config.rb', line 181 def plugins @plugins end |
- (Proc) print
Get/Set the Proc to use for printing by default by all Pry instances. Two parameters are passed to the print Proc: these are (1) the output object for the current session and (2) the expression value to print. It is important that you write to the output object instead of just stdout so that all Pry output can be redirected if necessary. This is the 'print' component of the REPL.
49 50 51 |
# File 'lib/pry/config.rb', line 49 def print @print end |
- (Array<Proc>, Proc) prompt
Get the array of Procs (or single Proc) to be used for the prompts by default by all Pry instances. Three parameters are passed into the prompt procs, (1) the object that is the target of the session, (2) the current nesting level, and (3) a reference to the associated Pry instance. These objects can be used in the prompt, if desired.
113 114 115 |
# File 'lib/pry/config.rb', line 113 def prompt @prompt end |
- (Array<String>) requires
Ruby files to be required after loading any plugins.
184 185 186 |
# File 'lib/pry/config.rb', line 184 def requires @requires end |
- (Boolean) should_load_plugins
Determines whether plugins should be loaded.
150 151 152 |
# File 'lib/pry/config.rb', line 150 def should_load_plugins @should_load_plugins end |
- (Boolean) should_load_rc
Determines whether the rc file (~/.pryrc) should be loaded.
146 147 148 |
# File 'lib/pry/config.rb', line 146 def should_load_rc @should_load_rc end |
- (Boolean) should_load_requires
Determines whether to load files specified with the -r flag.
154 155 156 |
# File 'lib/pry/config.rb', line 154 def should_load_requires @should_load_requires end |
- (Boolean) should_trap_interrupts
Determines whether Pry should trap SIGINT and cause it to raise an Interrupt exception. This is only useful on jruby, MRI does this for us.
164 165 166 |
# File 'lib/pry/config.rb', line 164 def should_trap_interrupts @should_trap_interrupts end |
- (Proc) system
The proc that runs system commands The proc is passed the pry output object, the command string to eval, and a reference to the pry instance
196 197 198 |
# File 'lib/pry/config.rb', line 196 def system @system end |