pry 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +36 -22
- data/lib/pry/basic_object.rb +1 -1
- data/lib/pry/cli.rb +2 -2
- data/lib/pry/code.rb +0 -8
- data/lib/pry/commands/ls/constants.rb +2 -2
- data/lib/pry/commands/watch_expression.rb +1 -1
- data/lib/pry/config.rb +8 -11
- data/lib/pry/core_extensions.rb +1 -1
- data/lib/pry/editor.rb +3 -1
- data/lib/pry/helpers/platform.rb +1 -6
- data/lib/pry/helpers/text.rb +5 -5
- data/lib/pry/indent.rb +7 -7
- data/lib/pry/input_completer.rb +1 -1
- data/lib/pry/method/weird_method_locator.rb +1 -1
- data/lib/pry/method.rb +3 -2
- data/lib/pry/pry_class.rb +14 -1
- data/lib/pry/pry_instance.rb +1 -1
- data/lib/pry/repl.rb +1 -2
- data/lib/pry/ring.rb +1 -1
- data/lib/pry/version.rb +1 -1
- data/lib/pry/warning.rb +3 -10
- data/lib/pry/wrapped_module/candidate.rb +9 -8
- data/lib/pry/wrapped_module.rb +2 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d8bac7565d29bff46039481c17aa6a88fec28084916dd8dad12cd4e83b146c1
|
4
|
+
data.tar.gz: 90b46a979aaac6d01ddf589217baca57bc2d7ce8197c8f27bc22f823eeaffcdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e671cca56deb75c1c47ba9108155bec171ebe34d5ba740b3dd7ea3e848fc789291111e40b7c604835b3d90209873a4a3364ec72a5f4c0f062dea98e5b466a30
|
7
|
+
data.tar.gz: f4c80ad6f3187823c18e1fff35306fc1e0a0ee4045a06b190f4742c92099b89d7ef5bafcb1c1dd68c8ae09b251a9a9b64bfd33179c2a7778f3122c90d636afa5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
### master
|
2
2
|
|
3
|
+
### [v0.14.2][v0.14.2] (January 9, 2023)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Configure `code` as a supported editor on Pry::Editor
|
8
|
+
([#2236](https://github.com/pry/pry/pull/2236))
|
9
|
+
* Added support for Ruby 3.2
|
10
|
+
([#2263](https://github.com/pry/pry/pull/2263))
|
11
|
+
* Added support for Ruby 3.1
|
12
|
+
([#2228](https://github.com/pry/pry/pull/2228))
|
13
|
+
|
14
|
+
#### Bug fixes
|
15
|
+
|
16
|
+
* Short circuit eval regexes in finding module definition
|
17
|
+
([#2253](https://github.com/pry/pry/pull/2253))
|
18
|
+
* Revert "Escape non-printing characters"
|
19
|
+
([#2235](https://github.com/pry/pry/pull/2235))
|
20
|
+
* Fixed bug where WeirdMethodLocator would fail to find the source of a method breaking whereami
|
21
|
+
([#2244](https://github.com/pry/pry/pull/2244))
|
22
|
+
* Fixed bug where pry would throw an FrozenError when dealing with incomplete tokens
|
23
|
+
([#2136](https://github.com/pry/pry/pull/2136))
|
24
|
+
* Restore --no-history CLI flag functionality
|
25
|
+
([#2196](https://github.com/pry/pry/pull/2196))
|
26
|
+
* Fixed bug where reading from the `_out_` sticky local variable could return
|
27
|
+
wrong results ([#2201](https://github.com/pry/pry/pull/2201))
|
28
|
+
|
29
|
+
#### Breaking Changes
|
30
|
+
|
31
|
+
* Remove support for Ruby 1.9 and JRuby < 9.0
|
32
|
+
([#2239](https://github.com/pry/pry/pull/2239))
|
33
|
+
|
3
34
|
### [v0.14.1][v0.14.1] (April 12, 2021)
|
4
35
|
|
5
36
|
#### Bug fixes
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Pry
|
2
2
|
===
|
3
3
|
|
4
|
-
[![
|
4
|
+
[![Pry Build Status](https://github.com/pry/pry/workflows/pry/badge.svg)](https://github.com/pry/pry/actions)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/pry/pry.svg)](https://codeclimate.com/github/pry/pry)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/pry.svg)](https://badge.fury.io/rb/pry)
|
7
7
|
[![Documentation Status](https://inch-ci.org/github/pry/pry.svg?branch=master)](https://inch-ci.org/github/pry/pry)
|
@@ -21,7 +21,7 @@ Pry
|
|
21
21
|
|
22
22
|
**Links:**
|
23
23
|
|
24
|
-
* https://pry.github.
|
24
|
+
* https://pry.github.io/
|
25
25
|
* [YARD API documentation](https://www.rubydoc.info/gems/pry)
|
26
26
|
* [Wiki](https://github.com/pry/pry/wiki)
|
27
27
|
|
@@ -38,7 +38,6 @@ Table of Contents
|
|
38
38
|
* [Command Shell Integration](#command-shell-integration)
|
39
39
|
* [Code Browsing](#code-browsing)
|
40
40
|
* [Documentation Browsing](#documentation-browsing)
|
41
|
-
* [Gist integration](#gist-integration)
|
42
41
|
* [Edit methods](#edit-methods)
|
43
42
|
* [Live Help System](#live-help-system)
|
44
43
|
* [Use Pry as your Rails Console](#use-pry-as-your-rails-console)
|
@@ -208,7 +207,7 @@ hello world!
|
|
208
207
|
pry(main)> def a.goodbye
|
209
208
|
pry(main)* puts "goodbye cruel world!"
|
210
209
|
pry(main)* end
|
211
|
-
=>
|
210
|
+
=> :goodbye
|
212
211
|
pry(main)> a.goodbye
|
213
212
|
goodbye cruel world!
|
214
213
|
=> nil
|
@@ -266,23 +265,26 @@ syntax and also simply the name of a method that's in scope. You can optionally
|
|
266
265
|
pass the `-l` option to `show-source` to include line numbers in the output.
|
267
266
|
|
268
267
|
In the following example we will enter the `Pry` class, list the instance
|
269
|
-
methods beginning with '
|
268
|
+
methods beginning with 'se' and display the source code for the `set_last_result` method:
|
270
269
|
|
271
270
|
```ruby
|
272
271
|
pry(main)> cd Pry
|
273
|
-
pry(Pry):1> ls -M --grep
|
274
|
-
Pry#methods:
|
275
|
-
pry(Pry):1> show-source
|
276
|
-
|
277
|
-
From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:
|
272
|
+
pry(Pry):1> ls -M --grep se
|
273
|
+
Pry#methods: raise_up raise_up! raise_up_common reset_eval_string select_prompt set_last_result
|
274
|
+
pry(Pry):1> show-source set_last_result -l
|
275
|
+
|
276
|
+
From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:405:
|
277
|
+
Owner: Pry
|
278
|
+
Visibility: public
|
279
|
+
Signature: set_last_result(result, code=?)
|
278
280
|
Number of lines: 6
|
279
281
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
282
|
+
405: def set_last_result(result, code = "")
|
283
|
+
406: @last_result_is_exception = false
|
284
|
+
407: @output_ring << result
|
285
|
+
408:
|
286
|
+
409: self.last_result = result unless code =~ /\A\s*\z/
|
287
|
+
410: end
|
286
288
|
```
|
287
289
|
|
288
290
|
Note that we can also view C methods (from Ruby Core) using the
|
@@ -317,7 +319,7 @@ rb_ary_select(VALUE ary)
|
|
317
319
|
One use-case for Pry is to explore a program at run-time by `cd`-ing in and out
|
318
320
|
of objects and viewing and invoking methods. In the course of exploring it may
|
319
321
|
be useful to read the documentation for a specific method that you come
|
320
|
-
across.
|
322
|
+
across. `show-source` command supports two syntaxes - the
|
321
323
|
normal `ri` syntax as well as accepting the name of any method that is currently
|
322
324
|
in scope.
|
323
325
|
|
@@ -339,14 +341,26 @@ In our example we will enter the `Gem` class and view the documentation for the
|
|
339
341
|
|
340
342
|
```ruby
|
341
343
|
pry(main)> cd Gem
|
342
|
-
pry(Gem):1> show-
|
344
|
+
pry(Gem):1> show-source try_activate -d
|
343
345
|
|
344
|
-
From: /Users/john
|
345
|
-
|
346
|
+
From: /Users/john/rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:194:
|
347
|
+
Owner: #<Class:Gem>
|
348
|
+
Visibility: public
|
349
|
+
Signature: try_activate(path)
|
350
|
+
Number of lines: 28
|
346
351
|
|
347
352
|
Try to activate a gem containing path. Returns true if
|
348
353
|
activation succeeded or wasn't needed because it was already
|
349
354
|
activated. Returns false if it can't find the path in a gem.
|
355
|
+
|
356
|
+
def self.try_activate(path)
|
357
|
+
# finds the _latest_ version... regardless of loaded specs and their deps
|
358
|
+
# if another gem had a requirement that would mean we shouldn't
|
359
|
+
# activate the latest version, then either it would already be activated
|
360
|
+
# or if it was ambiguous (and thus unresolved) the code in our custom
|
361
|
+
# require will try to activate the more specific version.
|
362
|
+
|
363
|
+
spec = Gem::Specification.find_by_path path
|
350
364
|
pry(Gem):1>
|
351
365
|
```
|
352
366
|
|
@@ -427,8 +441,8 @@ putting the line `Pry.color = false` in your `pryrc` file.
|
|
427
441
|
Supported Rubies
|
428
442
|
----------------
|
429
443
|
|
430
|
-
* CRuby >=
|
431
|
-
* JRuby >=
|
444
|
+
* CRuby >= 2.0.0
|
445
|
+
* JRuby >= 9.0
|
432
446
|
|
433
447
|
Contact
|
434
448
|
-------
|
data/lib/pry/basic_object.rb
CHANGED
data/lib/pry/cli.rb
CHANGED
@@ -122,7 +122,7 @@ Pry::CLI.add_options do
|
|
122
122
|
banner(
|
123
123
|
"Usage: pry [OPTIONS]\n" \
|
124
124
|
"Start a Pry session.\n" \
|
125
|
-
"See http://
|
125
|
+
"See http://pry.github.io/ for more information.\n" \
|
126
126
|
"Copyright (c) 2016 John Mair (banisterfiend)" \
|
127
127
|
)
|
128
128
|
|
@@ -138,7 +138,7 @@ Pry::CLI.add_options do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
on "no-history", "Disable history loading" do
|
141
|
-
Pry.config.
|
141
|
+
Pry.config.history_load = false
|
142
142
|
end
|
143
143
|
|
144
144
|
on "no-color", "Disable syntax highlighting for session" do
|
data/lib/pry/code.rb
CHANGED
@@ -346,14 +346,6 @@ class Pry
|
|
346
346
|
''.respond_to?(method_name, include_private) || super
|
347
347
|
end
|
348
348
|
|
349
|
-
if RUBY_VERSION.start_with?('1.9')
|
350
|
-
# @todo This is needed for Ruby 1.9 support where `lines` return an
|
351
|
-
# Enumerator. Newer Rubies return an Array
|
352
|
-
def lines
|
353
|
-
super.to_a
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
349
|
protected
|
358
350
|
|
359
351
|
# An abstraction of the `dup.instance_eval` pattern used throughout this
|
@@ -4,8 +4,8 @@ class Pry
|
|
4
4
|
class Command
|
5
5
|
class Ls < Pry::ClassCommand
|
6
6
|
class Constants < Pry::Command::Ls::Formatter
|
7
|
-
DEPRECATED_CONSTANTS = [
|
8
|
-
|
7
|
+
DEPRECATED_CONSTANTS = %i[
|
8
|
+
Data Fixnum Bignum TimeoutError NIL FALSE TRUE
|
9
9
|
].tap do |constants|
|
10
10
|
constants << :JavaPackageModuleTemplate if Helpers::Platform.jruby?
|
11
11
|
end
|
data/lib/pry/config.rb
CHANGED
@@ -301,17 +301,14 @@ class Pry
|
|
301
301
|
end
|
302
302
|
|
303
303
|
def default_rc_file
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
else
|
313
|
-
'~/.config/pry/pryrc'
|
314
|
-
end
|
304
|
+
[Pry::Env['PRYRC'],
|
305
|
+
# See XDG Base Directory Specification at
|
306
|
+
# https://specifications.freedesktop.org/basedir-spec/latest/
|
307
|
+
"#{Pry::Env['XDG_CONFIG_HOME']}/pry/pryrc",
|
308
|
+
File.expand_path('~/.pryrc'),
|
309
|
+
File.expand_path('~/.config/pry/pryrc')]
|
310
|
+
.compact
|
311
|
+
.find { |file| File.exist?(file) }
|
315
312
|
end
|
316
313
|
end
|
317
314
|
end
|
data/lib/pry/core_extensions.rb
CHANGED
@@ -78,7 +78,7 @@ class Object
|
|
78
78
|
# Module.new.class_eval("binding") has different behaviour than CRuby,
|
79
79
|
# where this is not needed: class_eval("binding") vs class_eval{binding}.
|
80
80
|
# Using a block works around the difference of behaviour on JRuby.
|
81
|
-
# The scope is clear of local
|
81
|
+
# The scope is clear of local variables. Don't add any.
|
82
82
|
#
|
83
83
|
# This fixes the following two spec failures, at https://travis-ci.org/pry/pry/jobs/274470002
|
84
84
|
# 1) ./spec/pry_spec.rb:360:in `block in (root)'
|
data/lib/pry/editor.rb
CHANGED
@@ -105,7 +105,7 @@ class Pry
|
|
105
105
|
'--nofork' if blocking
|
106
106
|
when /^jedit/
|
107
107
|
'-wait' if blocking
|
108
|
-
when /^mate/, /^subl/, /^redcar/
|
108
|
+
when /^mate/, /^subl/, /^redcar/, /^code/
|
109
109
|
'-w' if blocking
|
110
110
|
end
|
111
111
|
end
|
@@ -121,6 +121,8 @@ class Pry
|
|
121
121
|
"+#{line_number} #{file_name}"
|
122
122
|
when /^mate/, /^geany/
|
123
123
|
"-l #{line_number} #{file_name}"
|
124
|
+
when /^code/
|
125
|
+
"-g #{file_name}:#{line_number}"
|
124
126
|
when /^subl/
|
125
127
|
"#{file_name}:#{line_number}"
|
126
128
|
when /^uedit32/
|
data/lib/pry/helpers/platform.rb
CHANGED
@@ -28,7 +28,7 @@ class Pry
|
|
28
28
|
def self.windows_ansi?
|
29
29
|
return false unless windows?
|
30
30
|
|
31
|
-
!!(defined?(Win32::Console) || Pry::Env['ANSICON'] ||
|
31
|
+
!!(defined?(Win32::Console) || Pry::Env['ANSICON'] || mri?)
|
32
32
|
end
|
33
33
|
|
34
34
|
# @return [Boolean]
|
@@ -46,11 +46,6 @@ class Pry
|
|
46
46
|
RbConfig::CONFIG['ruby_install_name'] == 'ruby'
|
47
47
|
end
|
48
48
|
|
49
|
-
# @return [Boolean]
|
50
|
-
def self.mri_19?
|
51
|
-
mri? && RUBY_VERSION.start_with?('1.9')
|
52
|
-
end
|
53
|
-
|
54
49
|
# @return [Boolean]
|
55
50
|
def self.mri_2?
|
56
51
|
mri? && RUBY_VERSION.start_with?('2')
|
data/lib/pry/helpers/text.rb
CHANGED
@@ -21,20 +21,20 @@ class Pry
|
|
21
21
|
|
22
22
|
COLORS.each_pair do |color, value|
|
23
23
|
define_method color do |text|
|
24
|
-
"\
|
24
|
+
"\033[0;#{30 + value}m#{text}\033[0m"
|
25
25
|
end
|
26
26
|
|
27
27
|
define_method "bright_#{color}" do |text|
|
28
|
-
"\
|
28
|
+
"\033[1;#{30 + value}m#{text}\033[0m"
|
29
29
|
end
|
30
30
|
|
31
31
|
COLORS.each_pair do |bg_color, bg_value|
|
32
32
|
define_method "#{color}_on_#{bg_color}" do |text|
|
33
|
-
"\
|
33
|
+
"\033[0;#{30 + value};#{40 + bg_value}m#{text}\033[0m"
|
34
34
|
end
|
35
35
|
|
36
36
|
define_method "bright_#{color}_on_#{bg_color}" do |text|
|
37
|
-
"\
|
37
|
+
"\033[1;#{30 + value};#{40 + bg_value}m#{text}\033[0m"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -52,7 +52,7 @@ class Pry
|
|
52
52
|
# @param [String, #to_s] text
|
53
53
|
# @return [String] _text_
|
54
54
|
def bold(text)
|
55
|
-
"\
|
55
|
+
"\e[1m#{text}\e[0m"
|
56
56
|
end
|
57
57
|
|
58
58
|
# Returns `text` in the default foreground colour.
|
data/lib/pry/indent.rb
CHANGED
@@ -57,8 +57,8 @@ class Pry
|
|
57
57
|
#
|
58
58
|
# :pre_constant and :preserved_constant are the CodeRay 0.9.8 and 1.0.0
|
59
59
|
# classifications of "true", "false", and "nil".
|
60
|
-
IGNORE_TOKENS = [
|
61
|
-
|
60
|
+
IGNORE_TOKENS = %i[space content string method ident
|
61
|
+
constant pre_constant predefined_constant].freeze
|
62
62
|
|
63
63
|
# Tokens that indicate the end of a statement (i.e. that, if they appear
|
64
64
|
# directly before an "if" indicates that that if applies to the same line,
|
@@ -66,10 +66,10 @@ class Pry
|
|
66
66
|
#
|
67
67
|
# :reserved and :keywords are the CodeRay 0.9.8 and 1.0.0 respectively
|
68
68
|
# classifications of "super", "next", "return", etc.
|
69
|
-
STATEMENT_END_TOKENS = IGNORE_TOKENS + [
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
STATEMENT_END_TOKENS = IGNORE_TOKENS + %i[regexp integer float
|
70
|
+
keyword delimiter reserved
|
71
|
+
instance_variable
|
72
|
+
class_variable global_variable]
|
73
73
|
|
74
74
|
# Collection of tokens that should appear dedented even though they
|
75
75
|
# don't affect the surrounding code.
|
@@ -109,7 +109,7 @@ class Pry
|
|
109
109
|
# reset internal state
|
110
110
|
def reset
|
111
111
|
@stack = []
|
112
|
-
@indent_level =
|
112
|
+
@indent_level = String.new # rubocop:disable Style/EmptyLiteral
|
113
113
|
@heredoc_queue = []
|
114
114
|
@close_heredocs = {}
|
115
115
|
@string_start = nil
|
data/lib/pry/input_completer.rb
CHANGED
@@ -270,7 +270,7 @@ class Pry
|
|
270
270
|
end
|
271
271
|
|
272
272
|
# FIXME: Add Pry here as well?
|
273
|
-
[
|
273
|
+
%i[IRB SLex RubyLex RubyToken].each do |module_name|
|
274
274
|
next unless Object.const_defined?(module_name)
|
275
275
|
|
276
276
|
scanner.call(Object.const_get(module_name))
|
@@ -158,7 +158,7 @@ class Pry
|
|
158
158
|
|
159
159
|
alias_name = all_methods_for(target_self).find do |v|
|
160
160
|
location = target_self.method(v).source_location
|
161
|
-
expanded_source_location(location) == renamed_method_source_location
|
161
|
+
location && expanded_source_location(location) == renamed_method_source_location
|
162
162
|
end
|
163
163
|
|
164
164
|
alias_name && Pry::Method(target_self.method(alias_name))
|
data/lib/pry/method.rb
CHANGED
@@ -530,8 +530,9 @@ class Pry
|
|
530
530
|
else
|
531
531
|
fail_msg = "Cannot locate this method: #{name}."
|
532
532
|
if Helpers::Platform.mri?
|
533
|
-
fail_msg += "
|
534
|
-
"
|
533
|
+
fail_msg += " Run `gem install pry-doc` to install" \
|
534
|
+
" Ruby Core documentation," \
|
535
|
+
" and `require 'pry-doc'` to load it.\n"
|
535
536
|
end
|
536
537
|
raise CommandError, fail_msg
|
537
538
|
end
|
data/lib/pry/pry_class.rb
CHANGED
@@ -85,7 +85,7 @@ class Pry
|
|
85
85
|
# Load the local RC file (./.pryrc)
|
86
86
|
def self.rc_files_to_load
|
87
87
|
files = []
|
88
|
-
files << Pry.config.rc_file if Pry.config.should_load_rc
|
88
|
+
files << Pry.config.rc_file if Pry.config.rc_file && Pry.config.should_load_rc
|
89
89
|
files << LOCAL_RC_FILE if Pry.config.should_load_local_rc
|
90
90
|
files.map { |file| real_path_to(file) }.compact.uniq
|
91
91
|
end
|
@@ -168,6 +168,12 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc.
|
|
168
168
|
return
|
169
169
|
end
|
170
170
|
|
171
|
+
unless mutex_available?
|
172
|
+
output.puts "ERROR: Unable to obtain mutex lock."
|
173
|
+
output.puts "This can happen if binding.pry is called from a signal handler"
|
174
|
+
return
|
175
|
+
end
|
176
|
+
|
171
177
|
options[:target] = Pry.binding_for(target || toplevel_binding)
|
172
178
|
initial_session_setup
|
173
179
|
final_session_setup
|
@@ -378,6 +384,13 @@ Readline version #{Readline::VERSION} detected - will not auto_resize! correctly
|
|
378
384
|
ensure
|
379
385
|
Thread.current[:pry_critical_section] -= 1
|
380
386
|
end
|
387
|
+
|
388
|
+
def self.mutex_available?
|
389
|
+
Mutex.new.synchronize { true }
|
390
|
+
rescue ThreadError
|
391
|
+
false
|
392
|
+
end
|
393
|
+
private_class_method :mutex_available?
|
381
394
|
end
|
382
395
|
|
383
396
|
Pry.init
|
data/lib/pry/pry_instance.rb
CHANGED
@@ -20,7 +20,7 @@ require 'ostruct'
|
|
20
20
|
# This will show a list of available commands and their usage. For more
|
21
21
|
# information about Pry you can refer to the following resources:
|
22
22
|
#
|
23
|
-
# *
|
23
|
+
# * https://pry.github.io
|
24
24
|
# * https://github.com/pry/pry
|
25
25
|
# * the IRC channel, which is #pry on the Freenode network
|
26
26
|
#
|
data/lib/pry/repl.rb
CHANGED
@@ -141,8 +141,7 @@ class Pry
|
|
141
141
|
retry
|
142
142
|
|
143
143
|
# Handle <Ctrl+C> like Bash: empty the current input buffer, but don't
|
144
|
-
# quit.
|
145
|
-
# send Interrupt from within Readline.
|
144
|
+
# quit.
|
146
145
|
rescue Interrupt
|
147
146
|
return :control_c
|
148
147
|
|
data/lib/pry/ring.rb
CHANGED
@@ -56,8 +56,8 @@ class Pry
|
|
56
56
|
# exist
|
57
57
|
def [](index)
|
58
58
|
@mutex.synchronize do
|
59
|
-
return @buffer[(count + index) % max_size] if index.is_a?(Integer)
|
60
59
|
return @buffer[index] if count <= max_size
|
60
|
+
return @buffer[(count + index) % max_size] if index.is_a?(Integer)
|
61
61
|
|
62
62
|
transpose_buffer_tail[index]
|
63
63
|
end
|
data/lib/pry/version.rb
CHANGED
data/lib/pry/warning.rb
CHANGED
@@ -10,16 +10,9 @@ class Pry
|
|
10
10
|
# @param [String] message
|
11
11
|
# @return [void]
|
12
12
|
def self.warn(message)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
lineno = location.lineno
|
17
|
-
else
|
18
|
-
# Ruby 1.9.3 support.
|
19
|
-
frame = caller[1].split(':') # rubocop:disable Performance/Caller
|
20
|
-
path = frame.first
|
21
|
-
lineno = frame[1]
|
22
|
-
end
|
13
|
+
location = caller_locations(2..2).first
|
14
|
+
path = location.path
|
15
|
+
lineno = location.lineno
|
23
16
|
|
24
17
|
Kernel.warn("#{path}:#{lineno}: warning: #{message}")
|
25
18
|
end
|
@@ -20,9 +20,9 @@ class Pry
|
|
20
20
|
|
21
21
|
# Methods to delegate to associated `Pry::WrappedModule
|
22
22
|
# instance`.
|
23
|
-
private_delegates = [
|
24
|
-
public_delegates = [
|
25
|
-
|
23
|
+
private_delegates = %i[lines_for_file method_candidates yard_docs? name]
|
24
|
+
public_delegates = %i[wrapped module? class? nonblank_name
|
25
|
+
number_of_candidates]
|
26
26
|
|
27
27
|
def_delegators :@wrapper, *public_delegates
|
28
28
|
def_private_delegators :@wrapper, *private_delegates
|
@@ -98,14 +98,15 @@ class Pry
|
|
98
98
|
# line number is one-indexed.
|
99
99
|
def first_line_of_module_definition(file, line)
|
100
100
|
searchable_lines = lines_for_file(file)[0..(line - 2)]
|
101
|
-
searchable_lines.rindex { |v|
|
101
|
+
searchable_lines.rindex { |v| module_definition_first_line?(v) } + 1
|
102
102
|
end
|
103
103
|
|
104
|
-
def
|
104
|
+
def module_definition_first_line?(line)
|
105
105
|
mod_type_string = wrapped.class.to_s.downcase
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
wrapped_name_last = wrapped.name.split(/::/).last
|
107
|
+
/(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped_name_last}/ =~ line ||
|
108
|
+
/^\s*(::)?#{wrapped_name_last}\s*?=\s*?#{wrapped.class}/ =~ line ||
|
109
|
+
/^\s*(::)?#{wrapped_name_last}\.(class|instance)_eval/ =~ line
|
109
110
|
end
|
110
111
|
|
111
112
|
# This method is used by `Candidate#source_location` as a
|
data/lib/pry/wrapped_module.rb
CHANGED
@@ -246,19 +246,14 @@ class Pry
|
|
246
246
|
method_candidates.count
|
247
247
|
end
|
248
248
|
|
249
|
-
# @
|
250
|
-
# away its ability to be quick (when there are lots of monkey patches,
|
251
|
-
# like in Rails). However, it should be efficient enough on other rubies.
|
252
|
-
# @see https://github.com/jruby/jruby/issues/525
|
253
|
-
# @return [Enumerator, Array] on JRuby 1.9 and higher returns Array, on
|
254
|
-
# other rubies returns Enumerator
|
249
|
+
# @return [Array]
|
255
250
|
def candidates
|
256
251
|
enum = Enumerator.new do |y|
|
257
252
|
(0...number_of_candidates).each do |num|
|
258
253
|
y.yield candidate(num)
|
259
254
|
end
|
260
255
|
end
|
261
|
-
|
256
|
+
enum
|
262
257
|
end
|
263
258
|
|
264
259
|
# @return [Boolean] Whether YARD docs are available for this module.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mair (banisterfiend)
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: coderay
|
@@ -208,14 +208,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
208
|
requirements:
|
209
209
|
- - ">="
|
210
210
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
211
|
+
version: '2.0'
|
212
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
|
-
rubygems_version: 3.1
|
218
|
+
rubygems_version: 3.4.1
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: A runtime developer console and IRB alternative with powerful introspection
|