Class: Pry::Config Private

Inherits:
Object show all
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

Instance Method Summary collapse

Methods included from Attributable

attribute

Constructor Details

#initializeConfig

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_handlerObject

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_indentBoolean

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:

  • (Boolean)


109
# File 'lib/pry/config.rb', line 109

attribute :auto_indent

#collision_warningBoolean

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.

Returns:

  • (Boolean)

    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

#colorBoolean

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:

  • (Boolean)


59
# File 'lib/pry/config.rb', line 59

attribute :color

#command_completionsProc

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:

  • (Proc)


132
# File 'lib/pry/config.rb', line 132

attribute :command_completions

#command_prefixString

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”).

Returns:

  • (String)


56
# File 'lib/pry/config.rb', line 56

attribute :command_prefix

#commandsPry::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.

Returns:



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.

Returns:

  • (#build_completion_proc)

    a completer to use



122
# File 'lib/pry/config.rb', line 122

attribute :completer

#correct_indentBoolean

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:

  • (Boolean)


112
# File 'lib/pry/config.rb', line 112

attribute :correct_indent

#default_window_sizeInteger

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.

Returns:

  • (Integer)

    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_reloadBoolean

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.

Returns:

  • (Boolean)

    whether to disable edit-method’s auto-reloading behavior



77
# File 'lib/pry/config.rb', line 77

attribute :disable_auto_reload

#editorString, #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.

Returns:

  • (String, #call)


51
# File 'lib/pry/config.rb', line 51

attribute :editor

#exception_handlerProc

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.

Returns:

  • (Proc)

    the printer for exceptions



22
# File 'lib/pry/config.rb', line 22

attribute :exception_handler

#exec_stringString

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.

Returns:

  • (String)

    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_localsHash{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.

Returns:

  • (Hash{Symbol=>Proc})


119
# File 'lib/pry/config.rb', line 119

attribute :extra_sticky_locals

#file_completionsProc

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:

  • (Proc)


135
# File 'lib/pry/config.rb', line 135

attribute :file_completions

#historyPry::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.

Returns:



85
# File 'lib/pry/config.rb', line 85

attribute :history

#history_fileString

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:

  • (String)


94
# File 'lib/pry/config.rb', line 94

attribute :history_file

#history_ignorelistArray<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.

Returns:

  • (Array<String,Regexp>)


97
# File 'lib/pry/config.rb', line 97

attribute :history_ignorelist

#history_loadBoolean

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:

  • (Boolean)


91
# File 'lib/pry/config.rb', line 91

attribute :history_load

#history_saveBoolean

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:

  • (Boolean)


88
# File 'lib/pry/config.rb', line 88

attribute :history_save

#hooksPry::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.

Returns:



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

#inputIO, #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.

Returns:

  • (IO, #readline)

    the object from which Pry retrieves its lines of input



10
# File 'lib/pry/config.rb', line 10

attribute :input

#lsHash

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:

  • (Hash)


138
# File 'lib/pry/config.rb', line 138

attribute :ls

#memory_sizeInteger

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.

Returns:

  • (Integer)

    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

#multilineBoolean

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:

  • (Boolean)


65
# File 'lib/pry/config.rb', line 65

attribute :multiline

#outputIO, #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.

Returns:

  • (IO, #puts)

    where Pry should output results provided by #input



13
# File 'lib/pry/config.rb', line 13

attribute :output

#output_prefixString

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:

  • (String)


145
# File 'lib/pry/config.rb', line 145

attribute :output_prefix

#pagerBoolean

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:

  • (Boolean)


62
# File 'lib/pry/config.rb', line 62

attribute :pager

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).

Returns:

  • (Proc)

    the printer for Ruby expressions (not commands)



19
# File 'lib/pry/config.rb', line 19

attribute :print

#promptPry::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.

Returns:



35
# File 'lib/pry/config.rb', line 35

attribute :prompt

#prompt_nameString

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.

Returns:

  • (String)

    The display name that is part of the prompt



38
# File 'lib/pry/config.rb', line 38

attribute :prompt_name

#prompt_safe_contextsArray<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.

Returns:

  • (Array<Object>)

    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

#quietBoolean

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`.

Returns:

  • (Boolean)

    suppresses whereami output on ‘binding.pry`



125
# File 'lib/pry/config.rb', line 125

attribute :quiet

#rc_fileString

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:

  • (String)

Since:

  • v0.13.0



149
# File 'lib/pry/config.rb', line 149

attribute :rc_file

#requiresArray<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.

Returns:

  • (Array<String>)

    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

Returns:

  • (Boolean)


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_rcBoolean

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.

Returns:

  • (Boolean)

    whether the local ./.pryrc should be loaded



71
# File 'lib/pry/config.rb', line 71

attribute :should_load_local_rc

#should_load_rcBoolean

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.

Returns:

  • (Boolean)

    whether the global ~/.pryrc should be loaded



68
# File 'lib/pry/config.rb', line 68

attribute :should_load_rc

#should_load_requiresBoolean

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.

Returns:

  • (Boolean)

    whether to load files specified with the -r flag



74
# File 'lib/pry/config.rb', line 74

attribute :should_load_requires

#should_trap_interruptsBoolean

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.

Returns:

  • (Boolean)


82
# File 'lib/pry/config.rb', line 82

attribute :should_trap_interrupts

#systemProc

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.

Returns:

  • (Proc)

    The proc that runs system commands



106
# File 'lib/pry/config.rb', line 106

attribute :system

#unrescued_exceptionsArray

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.

Returns:

  • (Array)

    Exception that Pry shouldn’t rescue



25
# File 'lib/pry/config.rb', line 25

attribute :unrescued_exceptions

#windows_console_warningBoolean

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.

Returns:

  • (Boolean)

    displays a warning about experience improvement on Windows



129
# File 'lib/pry/config.rb', line 129

attribute :windows_console_warning