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.
- #exception_whitelist ⇒ Array deprecated private Deprecated.
-
#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
He 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.
-
#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.
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 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/pry/config.rb', line 154 def initialize merge!( input: MemoizedValue.new { lazy_readline }, 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 ], exception_whitelist: MemoizedValue.new do output.puts( '[warning] Pry.config.exception_whitelist is deprecated, ' \ 'please use Pry.config.unrescued_exceptions instead.' ) unrescued_exceptions end, hooks: Pry::Hooks.default, pager: true, system: Pry::SystemCommandHandler.method(:default), 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: OpenStruct.new(Pry::Command::Ls::DEFAULT_OPTIONS), 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
239 240 241 242 243 244 245 246 247 |
# File 'lib/pry/config.rb', line 239 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.
259 260 261 |
# File 'lib/pry/config.rb', line 259 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.
234 235 236 |
# File 'lib/pry/config.rb', line 234 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.
230 231 232 |
# File 'lib/pry/config.rb', line 230 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.
112 |
# File 'lib/pry/config.rb', line 112 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.
119 |
# File 'lib/pry/config.rb', line 119 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.
65 |
# File 'lib/pry/config.rb', line 65 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.
135 |
# File 'lib/pry/config.rb', line 135 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”).
62 |
# File 'lib/pry/config.rb', line 62 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.
18 |
# File 'lib/pry/config.rb', line 18 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.
125 |
# File 'lib/pry/config.rb', line 125 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.
115 |
# File 'lib/pry/config.rb', line 115 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.
35 |
# File 'lib/pry/config.rb', line 35 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.
80 |
# File 'lib/pry/config.rb', line 80 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.
57 |
# File 'lib/pry/config.rb', line 57 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.
24 |
# File 'lib/pry/config.rb', line 24 attribute :exception_handler |
#exception_whitelist ⇒ 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.
31 |
# File 'lib/pry/config.rb', line 31 attribute :exception_whitelist |
#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.
145 |
# File 'lib/pry/config.rb', line 145 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.
122 |
# File 'lib/pry/config.rb', line 122 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.
138 |
# File 'lib/pry/config.rb', line 138 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.
88 |
# File 'lib/pry/config.rb', line 88 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.
97 |
# File 'lib/pry/config.rb', line 97 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.
100 |
# File 'lib/pry/config.rb', line 100 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.
94 |
# File 'lib/pry/config.rb', line 94 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.
91 |
# File 'lib/pry/config.rb', line 91 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.
38 |
# File 'lib/pry/config.rb', line 38 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.
254 255 256 257 |
# File 'lib/pry/config.rb', line 254 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 he object from which Pry retrieves its lines of input.
12 |
# File 'lib/pry/config.rb', line 12 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.
141 |
# File 'lib/pry/config.rb', line 141 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.
106 |
# File 'lib/pry/config.rb', line 106 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.
226 227 228 |
# File 'lib/pry/config.rb', line 226 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.
221 222 223 224 |
# File 'lib/pry/config.rb', line 221 def merge!(config_hash) config_hash.each_pair { |attr, value| __send__("#{attr}=", value) } self end |
#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.
15 |
# File 'lib/pry/config.rb', line 15 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.
148 |
# File 'lib/pry/config.rb', line 148 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.
68 |
# File 'lib/pry/config.rb', line 68 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).
21 |
# File 'lib/pry/config.rb', line 21 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.
41 |
# File 'lib/pry/config.rb', line 41 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.
44 |
# File 'lib/pry/config.rb', line 44 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.
48 |
# File 'lib/pry/config.rb', line 48 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`.
128 |
# File 'lib/pry/config.rb', line 128 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.
152 |
# File 'lib/pry/config.rb', line 152 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.
103 |
# File 'lib/pry/config.rb', line 103 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
250 251 252 |
# File 'lib/pry/config.rb', line 250 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.
74 |
# File 'lib/pry/config.rb', line 74 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.
71 |
# File 'lib/pry/config.rb', line 71 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.
77 |
# File 'lib/pry/config.rb', line 77 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.
85 |
# File 'lib/pry/config.rb', line 85 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.
109 |
# File 'lib/pry/config.rb', line 109 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.
27 |
# File 'lib/pry/config.rb', line 27 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.
132 |
# File 'lib/pry/config.rb', line 132 attribute :windows_console_warning |