Class: Pry::Config Private
- Extended by:
- Attributable
- Defined in:
- lib/pry/config.rb,
lib/pry/config/value.rb,
lib/pry/config/lazy_value.rb,
lib/pry/config/attributable.rb,
lib/pry/config/memoized_value.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Attributable Classes: LazyValue, MemoizedValue, Value
Instance Attribute Summary collapse
- #control_d_handler ⇒ Object private
Instance Method Summary collapse
- #[](attr) ⇒ Object private
- #[]=(attr, value) ⇒ Object private
- #auto_indent ⇒ Boolean private
-
#collision_warning ⇒ Boolean
private
Whether or not display a warning when a command name collides with a method/local in the current context.
- #color ⇒ Boolean private
- #command_completions ⇒ Proc private
-
#command_prefix ⇒ String
private
A string that must precede all commands.
- #commands ⇒ Pry::CommandSet private
-
#completer ⇒ #build_completion_proc
private
A completer to use.
- #correct_indent ⇒ Boolean private
-
#default_window_size ⇒ Integer
private
The number of lines of context to show before and after exceptions.
-
#disable_auto_reload ⇒ Boolean
private
Whether to disable edit-method’s auto-reloading behavior.
-
#editor ⇒ String, #call
private
If it is a String, then that String is used as the shell command to invoke the editor.
-
#exception_handler ⇒ Proc
private
The printer for exceptions.
-
#exec_string ⇒ String
private
A line of code to execute in context before the session starts.
- #extra_sticky_locals ⇒ Hash{Symbol=>Proc} private
- #file_completions ⇒ Proc private
- #history ⇒ Pry::History private
- #history_file ⇒ String private
- #history_ignorelist ⇒ Array<String,Regexp> private
- #history_load ⇒ Boolean private
- #history_save ⇒ Boolean private
- #hooks ⇒ Pry::Hooks private
-
#initialize ⇒ Config
constructor
private
A new instance of Config.
- #initialize_dup(other) ⇒ Object private
-
#input ⇒ IO, #readline
private
The object from which Pry retrieves its lines of input.
- #ls ⇒ Hash private
-
#memory_size ⇒ Integer
private
How many input/output lines to keep in memory.
- #merge(config_hash) ⇒ Object private
- #merge!(config_hash) ⇒ Object private
-
#method_missing(method_name, *args, &_block) ⇒ Object
private
rubocop:disable Style/MethodMissingSuper.
- #multiline ⇒ Boolean private
-
#output ⇒ IO, #puts
private
Where Pry should output results provided by #input.
- #output_prefix ⇒ String private
- #pager ⇒ Boolean private
-
#print ⇒ Proc
private
The printer for Ruby expressions (not commands).
- #prompt ⇒ Pry::Prompt private
-
#prompt_name ⇒ String
private
The display name that is part of the prompt.
-
#prompt_safe_contexts ⇒ Array<Object>
private
The list of objects that are known to have a 1-line #inspect output suitable for prompt.
-
#quiet ⇒ Boolean
private
Suppresses whereami output on ‘binding.pry`.
- #rc_file ⇒ String private
-
#requires ⇒ Array<String>
private
Ruby files to be required.
-
#respond_to_missing?(method_name, include_all = false) ⇒ Boolean
private
rubocop:enable Style/MethodMissingSuper.
-
#should_load_local_rc ⇒ Boolean
private
Whether the local ./.pryrc should be loaded.
-
#should_load_rc ⇒ Boolean
private
Whether the global ~/.pryrc should be loaded.
-
#should_load_requires ⇒ Boolean
private
Whether to load files specified with the -r flag.
-
#should_trap_interrupts ⇒ Boolean
private
Whether Pry should trap SIGINT and cause it to raise an Interrupt exception.
-
#system ⇒ Proc
private
The proc that runs system commands.
-
#unrescued_exceptions ⇒ Array
private
Exception that Pry shouldn’t rescue.
-
#windows_console_warning ⇒ Boolean
private
Displays a warning about experience improvement on Windows.
Methods included from Attributable
Constructor Details
#initialize ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Config.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/pry/config.rb', line 151 def initialize merge!( input: MemoizedValue.new { choose_input }, output: $stdout.tap { |out| out.sync = true }, commands: Pry::Commands, prompt_name: 'pry', prompt: Pry::Prompt[:default], prompt_safe_contexts: [String, Numeric, Symbol, nil, true, false], print: Pry::ColorPrinter.method(:default), quiet: false, exception_handler: Pry::ExceptionHandler.method(:handle_exception), unrescued_exceptions: [ ::SystemExit, ::SignalException, Pry::TooSafeException ], hooks: Pry::Hooks.default, pager: true, system: Pry::SystemCommandHandler.method(:default), multiline: true, color: Pry::Helpers::BaseHelpers.use_ansi_codes?, default_window_size: 5, editor: Pry::Editor.default, rc_file: default_rc_file, should_load_rc: true, should_load_local_rc: true, should_trap_interrupts: Pry::Helpers::Platform.jruby?, disable_auto_reload: false, command_prefix: '', auto_indent: Pry::Helpers::BaseHelpers.use_ansi_codes?, correct_indent: true, collision_warning: false, output_prefix: '=> ', requires: [], should_load_requires: true, windows_console_warning: true, control_d_handler: Pry::ControlDHandler.method(:default), memory_size: 100, extra_sticky_locals: {}, command_completions: proc { commands.keys }, file_completions: proc { Dir['.'] }, ls: Pry::Command::Ls::Config.default, completer: Pry::InputCompleter, history_save: true, history_load: true, history_file: Pry::History.default_file, history_ignorelist: [], history: MemoizedValue.new do if defined?(input::HISTORY) Pry::History.new(history: input::HISTORY) else Pry::History.new end end, exec_string: '' ) @custom_attrs = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &_block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Style/MethodMissingSuper
229 230 231 232 233 234 235 236 237 |
# File 'lib/pry/config.rb', line 229 def method_missing(method_name, *args, &_block) name = method_name.to_s if name.end_with?('=') self[name[0..-2]] = args.first elsif @custom_attrs.key?(name) self[name] end end |
Instance Attribute Details
#control_d_handler ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
249 250 251 |
# File 'lib/pry/config.rb', line 249 def control_d_handler @control_d_handler end |
Instance Method Details
#[](attr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
224 225 226 |
# File 'lib/pry/config.rb', line 224 def [](attr) @custom_attrs[attr.to_s].call end |
#[]=(attr, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
220 221 222 |
# File 'lib/pry/config.rb', line 220 def []=(attr, value) @custom_attrs[attr.to_s] = Config::Value.new(value) end |
#auto_indent ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 |
# File 'lib/pry/config.rb', line 109 attribute :auto_indent |
#collision_warning ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether or not display a warning when a command name collides with a method/local in the current context.
116 |
# File 'lib/pry/config.rb', line 116 attribute :collision_warning |
#color ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 |
# File 'lib/pry/config.rb', line 59 attribute :color |
#command_completions ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
132 |
# File 'lib/pry/config.rb', line 132 attribute :command_completions |
#command_prefix ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A string that must precede all commands. For example, if is is set to “%”, the “cd” command must be invoked as “%cd”).
56 |
# File 'lib/pry/config.rb', line 56 attribute :command_prefix |
#commands ⇒ Pry::CommandSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 |
# File 'lib/pry/config.rb', line 16 attribute :commands |
#completer ⇒ #build_completion_proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a completer to use.
122 |
# File 'lib/pry/config.rb', line 122 attribute :completer |
#correct_indent ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
112 |
# File 'lib/pry/config.rb', line 112 attribute :correct_indent |
#default_window_size ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The number of lines of context to show before and after exceptions.
29 |
# File 'lib/pry/config.rb', line 29 attribute :default_window_size |
#disable_auto_reload ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether to disable edit-method’s auto-reloading behavior.
77 |
# File 'lib/pry/config.rb', line 77 attribute :disable_auto_reload |
#editor ⇒ String, #call
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If it is a String, then that String is used as the shell command to invoke the editor.
If it responds to #call is callable then ‘file`, `line`, and `reloading` are passed to it. `reloading` indicates whether Pry will be reloading code after the shell command returns. All parameters are optional.
51 |
# File 'lib/pry/config.rb', line 51 attribute :editor |
#exception_handler ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the printer for exceptions.
22 |
# File 'lib/pry/config.rb', line 22 attribute :exception_handler |
#exec_string ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a line of code to execute in context before the session starts.
142 |
# File 'lib/pry/config.rb', line 142 attribute :exec_string |
#extra_sticky_locals ⇒ Hash{Symbol=>Proc}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
119 |
# File 'lib/pry/config.rb', line 119 attribute :extra_sticky_locals |
#file_completions ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 |
# File 'lib/pry/config.rb', line 135 attribute :file_completions |
#history ⇒ Pry::History
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
85 |
# File 'lib/pry/config.rb', line 85 attribute :history |
#history_file ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 |
# File 'lib/pry/config.rb', line 94 attribute :history_file |
#history_ignorelist ⇒ Array<String,Regexp>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 |
# File 'lib/pry/config.rb', line 97 attribute :history_ignorelist |
#history_load ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 |
# File 'lib/pry/config.rb', line 91 attribute :history_load |
#history_save ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
88 |
# File 'lib/pry/config.rb', line 88 attribute :history_save |
#hooks ⇒ Pry::Hooks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 |
# File 'lib/pry/config.rb', line 32 attribute :hooks |
#initialize_dup(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
244 245 246 247 |
# File 'lib/pry/config.rb', line 244 def initialize_dup(other) super @custom_attrs = @custom_attrs.dup end |
#input ⇒ IO, #readline
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the object from which Pry retrieves its lines of input.
10 |
# File 'lib/pry/config.rb', line 10 attribute :input |
#ls ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
138 |
# File 'lib/pry/config.rb', line 138 attribute :ls |
#memory_size ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns how many input/output lines to keep in memory.
103 |
# File 'lib/pry/config.rb', line 103 attribute :memory_size |
#merge(config_hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
216 217 218 |
# File 'lib/pry/config.rb', line 216 def merge(config_hash) dup.merge!(config_hash) end |
#merge!(config_hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
211 212 213 214 |
# File 'lib/pry/config.rb', line 211 def merge!(config_hash) config_hash.each_pair { |attr, value| __send__("#{attr}=", value) } self end |
#multiline ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 |
# File 'lib/pry/config.rb', line 65 attribute :multiline |
#output ⇒ IO, #puts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns where Pry should output results provided by #input.
13 |
# File 'lib/pry/config.rb', line 13 attribute :output |
#output_prefix ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
145 |
# File 'lib/pry/config.rb', line 145 attribute :output_prefix |
#pager ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 |
# File 'lib/pry/config.rb', line 62 attribute :pager |
#print ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the printer for Ruby expressions (not commands).
19 |
# File 'lib/pry/config.rb', line 19 attribute :print |
#prompt ⇒ Pry::Prompt
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 |
# File 'lib/pry/config.rb', line 35 attribute :prompt |
#prompt_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The display name that is part of the prompt.
38 |
# File 'lib/pry/config.rb', line 38 attribute :prompt_name |
#prompt_safe_contexts ⇒ Array<Object>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the list of objects that are known to have a 1-line #inspect output suitable for prompt.
42 |
# File 'lib/pry/config.rb', line 42 attribute :prompt_safe_contexts |
#quiet ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns suppresses whereami output on ‘binding.pry`.
125 |
# File 'lib/pry/config.rb', line 125 attribute :quiet |
#rc_file ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
149 |
# File 'lib/pry/config.rb', line 149 attribute :rc_file |
#requires ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Ruby files to be required.
100 |
# File 'lib/pry/config.rb', line 100 attribute :requires |
#respond_to_missing?(method_name, include_all = false) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:enable Style/MethodMissingSuper
240 241 242 |
# File 'lib/pry/config.rb', line 240 def respond_to_missing?(method_name, include_all = false) @custom_attrs.key?(method_name.to_s.tr('=', '')) || super end |
#should_load_local_rc ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether the local ./.pryrc should be loaded.
71 |
# File 'lib/pry/config.rb', line 71 attribute :should_load_local_rc |
#should_load_rc ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether the global ~/.pryrc should be loaded.
68 |
# File 'lib/pry/config.rb', line 68 attribute :should_load_rc |
#should_load_requires ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether to load files specified with the -r flag.
74 |
# File 'lib/pry/config.rb', line 74 attribute :should_load_requires |
#should_trap_interrupts ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether Pry should trap SIGINT and cause it to raise an Interrupt exception. This is only useful on JRuby, MRI does this for us.
82 |
# File 'lib/pry/config.rb', line 82 attribute :should_trap_interrupts |
#system ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The proc that runs system commands.
106 |
# File 'lib/pry/config.rb', line 106 attribute :system |
#unrescued_exceptions ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Exception that Pry shouldn’t rescue.
25 |
# File 'lib/pry/config.rb', line 25 attribute :unrescued_exceptions |
#windows_console_warning ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns displays a warning about experience improvement on Windows.
129 |
# File 'lib/pry/config.rb', line 129 attribute :windows_console_warning |