Class: Pry::Config
Instance Attribute Summary collapse
-
#auto_indent ⇒ Boolean
Whether or not code should be indented using Pry::Indent.
-
#collision_warning ⇒ Boolean
Whether or not a warning will be displayed when a command name collides with a method/local in the current context.
-
#color ⇒ Boolean
Toggle Pry color on and off.
-
#command_prefix ⇒ String
A string that must precede all Pry commands (e.g., if command_prefix is set to "%", the "cd" command must be invoked as "%cd").
-
#commands ⇒ Pry::CommandBase
Get/Set the object to use for commands by default by all Pry instances.
-
#control_d_handler ⇒ Proc
The proc that manages ^D presses in the REPL.
-
#correct_indent ⇒ Boolean
Whether or not indentation should be corrected after hitting enter.
-
#default_window_size ⇒ Fixnum
The number of lines of context to show before and after exceptions, etc.
-
#disable_auto_reload ⇒ Boolean
Determines whether to disable edit-method's auto-reloading behavior.
-
#editor ⇒ String, #call
The default editor to use.
-
#exception_handler ⇒ Proc
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.
-
#exception_whitelist ⇒ Array
The classes of exception that will not be caught by Pry.
-
#extra_sticky_locals ⇒ Hash
Additional sticky locals (to the standard ones) to use in Pry sessions.
-
#gist ⇒ OpenStruct
Config option for gist.
-
#history ⇒ OpenStruct
Config option for history.
-
#hooks ⇒ Pry::Hooks
Get/Set the
Pry::Hooksinstance that defines Pry hooks used by default by all Pry instances. -
#input ⇒ #readline
Get/Set the object to use for input by default by all Pry instances.
-
#input_stack ⇒ Array
Get/Set the stack of input objects that a Pry instance switches to when its current input object encounters EOF.
-
#memory_size ⇒ Integer
Amount of results that will be stored into out.
-
#output ⇒ #puts
Get/Set the object to use for output by default by all Pry instances.
-
#pager ⇒ Boolean
Toggle paging on and off.
-
#plugins ⇒ OpenStruct
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). -
#print ⇒ Proc
Get/Set the Proc to use for printing by default by all Pry instances.
-
#prompt ⇒ Array<Proc>, Proc
Get the array of Procs (or single Proc) to be used for the prompts by default by all Pry instances.
-
#requires ⇒ Array<String>
Ruby files to be required after loading any plugins.
-
#should_load_local_rc ⇒ Boolean
Determines whether the local rc file (./.pryrc) should be loaded.
-
#should_load_plugins ⇒ Boolean
Determines whether plugins should be loaded.
-
#should_load_rc ⇒ Boolean
Determines whether the rc file (~/.pryrc) should be loaded.
-
#should_load_requires ⇒ Boolean
Determines whether to load files specified with the -r flag.
-
#should_trap_interrupts ⇒ Boolean
Determines whether Pry should trap SIGINT and cause it to raise an Interrupt exception.
-
#system ⇒ Proc
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
#auto_indent ⇒ Boolean
Returns Whether or not code should be indented using Pry::Indent.
204 205 206 |
# File 'lib/pry/config.rb', line 204 def auto_indent @auto_indent end |
#collision_warning ⇒ Boolean
Returns Whether or not a warning will be displayed when a command name collides with a method/local in the current context.
212 213 214 |
# File 'lib/pry/config.rb', line 212 def collision_warning @collision_warning end |
#color ⇒ Boolean
Returns Toggle Pry color on and off.
139 140 141 |
# File 'lib/pry/config.rb', line 139 def color @color end |
#command_prefix ⇒ String
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 |
#commands ⇒ Pry::CommandBase
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 |
#control_d_handler ⇒ Proc
Returns The proc that manages ^D presses in the REPL. The proc is passed the current eval_string and the current pry instance.
195 196 197 |
# File 'lib/pry/config.rb', line 195 def control_d_handler @control_d_handler end |
#correct_indent ⇒ Boolean
Returns Whether or not indentation should be corrected after hitting enter. This feature is not supported by all terminals.
208 209 210 |
# File 'lib/pry/config.rb', line 208 def correct_indent @correct_indent end |
#default_window_size ⇒ Fixnum
Returns 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 |
#disable_auto_reload ⇒ Boolean
Determines whether to disable edit-method's auto-reloading behavior.
162 163 164 |
# File 'lib/pry/config.rb', line 162 def disable_auto_reload @disable_auto_reload end |
#editor ⇒ String, #call
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 |
#exception_handler ⇒ Proc
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 |
#exception_whitelist ⇒ Array
Returns 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 |
#extra_sticky_locals ⇒ Hash
Returns Additional sticky locals (to the standard ones) to use in Pry sessions.
230 231 232 |
# File 'lib/pry/config.rb', line 230 def extra_sticky_locals @extra_sticky_locals end |
#gist ⇒ OpenStruct
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.
224 225 226 |
# File 'lib/pry/config.rb', line 224 def gist @gist end |
#history ⇒ OpenStruct
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.
179 180 181 |
# File 'lib/pry/config.rb', line 179 def history @history end |
#hooks ⇒ Pry::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 |
#input ⇒ #readline
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 |
#input_stack ⇒ Array
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 |
#memory_size ⇒ Integer
Returns Amount of results that will be stored into out.
191 192 193 |
# File 'lib/pry/config.rb', line 191 def memory_size @memory_size end |
#output ⇒ #puts
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 |
#pager ⇒ Boolean
Returns Toggle paging on and off.
142 143 144 |
# File 'lib/pry/config.rb', line 142 def pager @pager end |
#plugins ⇒ OpenStruct
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)
185 186 187 |
# File 'lib/pry/config.rb', line 185 def plugins @plugins end |
#print ⇒ Proc
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 |
#prompt ⇒ Array<Proc>, Proc
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 |
#requires ⇒ Array<String>
Returns Ruby files to be required after loading any plugins.
188 189 190 |
# File 'lib/pry/config.rb', line 188 def requires @requires end |
#should_load_local_rc ⇒ Boolean
Determines whether the local rc file (./.pryrc) should be loaded.
150 151 152 |
# File 'lib/pry/config.rb', line 150 def should_load_local_rc @should_load_local_rc end |
#should_load_plugins ⇒ Boolean
Determines whether plugins should be loaded.
154 155 156 |
# File 'lib/pry/config.rb', line 154 def should_load_plugins @should_load_plugins end |
#should_load_rc ⇒ Boolean
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 |
#should_load_requires ⇒ Boolean
Determines whether to load files specified with the -r flag.
158 159 160 |
# File 'lib/pry/config.rb', line 158 def should_load_requires @should_load_requires end |
#should_trap_interrupts ⇒ Boolean
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.
168 169 170 |
# File 'lib/pry/config.rb', line 168 def should_trap_interrupts @should_trap_interrupts end |
#system ⇒ Proc
Returns 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.
200 201 202 |
# File 'lib/pry/config.rb', line 200 def system @system end |