pry 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/pry/cli.rb +1 -1
- data/lib/pry/commands/show_doc.rb +1 -10
- data/lib/pry/commands/show_source.rb +3 -64
- data/lib/pry/config.rb +15 -8
- data/lib/pry/method/weird_method_locator.rb +3 -3
- data/lib/pry/method.rb +1 -1
- data/lib/pry/pry_class.rb +1 -28
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module/candidate.rb +7 -1
- data/lib/pry.rb +1 -1
- metadata +18 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f45a7ece4b6117e2ecb650b850bbafc729d1575d810ae709dff957979782b030
|
|
4
|
+
data.tar.gz: f3977bcef3004c4643ea02320dc4f3ca1d2958ea813665559bc2f0db01325efd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 276887cb72b590db134890f41b44dd6844bc1e5cd8307ca72236028967026c7f24fd07e14ae1d99840330672941740945a502ca965e2d7d00df400095af7a12a
|
|
7
|
+
data.tar.gz: 52146474624b386e394aaf5a21e371c5e52744a2aeff67468603a25b81bfb4bd83be027b7b2bf9aa9b987b22aa3a0efb3debc86d892536c00ad6a33465a33d85
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
### [v0.16.0](v0.16.0) (December 26, 2025)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Ruby 4.0 Support.
|
|
6
|
+
Pry will now require and default to Reline for newer Rubies.
|
|
7
|
+
([#2357](https://github.com/pry/pry/pull/2357))
|
|
8
|
+
([#2349](https://github.com/pry/pry/pull/2349))
|
|
9
|
+
* Revert 'Unify show-doc with show-source'.
|
|
10
|
+
([#2346](https://github.com/pry/pry/pull/2346))
|
|
11
|
+
|
|
12
|
+
#### Breaking Changes
|
|
13
|
+
|
|
14
|
+
* Remove experimental `Pry.auto_resize!`
|
|
15
|
+
Returns a warning. The code will be removed later.
|
|
16
|
+
([#2359](https://github.com/pry/pry/pull/2359))
|
|
17
|
+
* Drop support for Ruby < 2.6
|
|
18
|
+
([#2349](https://github.com/pry/pry/pull/2349))
|
|
19
|
+
|
|
1
20
|
### [v0.15.2](v0.15.2) (December 24, 2024)
|
|
2
21
|
|
|
3
22
|
#### Bug Fixes
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -9,9 +9,9 @@ Pry
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
© John Mair ([banisterfiend](https://twitter.com/banisterfiend))
|
|
12
|
+
© John Mair ([banisterfiend](https://twitter.com/banisterfiend)) 2010<br> (Creator)
|
|
13
13
|
|
|
14
|
-
© Kyrylo Silin ([kyrylosilin](https://twitter.com/kyrylosilin))
|
|
14
|
+
© Kyrylo Silin ([kyrylosilin](https://twitter.com/kyrylosilin)) 2010<br> (Maintainer)
|
|
15
15
|
|
|
16
16
|
**Alumni:**
|
|
17
17
|
|
data/lib/pry/cli.rb
CHANGED
|
@@ -123,7 +123,7 @@ Pry::CLI.add_options do
|
|
|
123
123
|
"Usage: pry [OPTIONS]\n" \
|
|
124
124
|
"Start a Pry session.\n" \
|
|
125
125
|
"See http://pry.github.io/ for more information.\n" \
|
|
126
|
-
"Copyright (c)
|
|
126
|
+
"Copyright (c) 2010 John Mair (banisterfiend)" \
|
|
127
127
|
)
|
|
128
128
|
|
|
129
129
|
on(
|
|
@@ -21,16 +21,6 @@ class Pry
|
|
|
21
21
|
show-doc Pry -a # for all definitions of Pry class (all monkey patches)
|
|
22
22
|
BANNER
|
|
23
23
|
|
|
24
|
-
def process
|
|
25
|
-
super
|
|
26
|
-
|
|
27
|
-
output.puts(
|
|
28
|
-
"\nWARNING: the show-doc command is deprecated. It will be removed " \
|
|
29
|
-
"from future Pry versions.\nPlease use 'show-source' with the -d " \
|
|
30
|
-
"(or --doc) switch instead\nExample: show-source #{obj_name} -d"
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
24
|
# The docs for code_object prepared for display.
|
|
35
25
|
def content_for(code_object)
|
|
36
26
|
Code.new(
|
|
@@ -89,5 +79,6 @@ class Pry
|
|
|
89
79
|
end
|
|
90
80
|
|
|
91
81
|
Pry::Commands.add_command(Pry::Command::ShowDoc)
|
|
82
|
+
Pry::Commands.alias_command '?', 'show-doc'
|
|
92
83
|
end
|
|
93
84
|
end
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
class Pry
|
|
4
4
|
class Command
|
|
5
5
|
class ShowSource < Command::ShowInfo
|
|
6
|
-
include Pry::Helpers::DocumentationHelpers
|
|
7
|
-
|
|
8
6
|
match 'show-source'
|
|
9
7
|
group 'Introspection'
|
|
10
8
|
description 'Show the source for a method or class.'
|
|
@@ -23,7 +21,6 @@ class Pry
|
|
|
23
21
|
show-source Pry -a # for all Pry class definitions (all monkey patches)
|
|
24
22
|
show-source Pry.foo -e # for class of the return value of expression `Pry.foo`
|
|
25
23
|
show-source Pry --super # for superclass of Pry (Object class)
|
|
26
|
-
show-source Pry -d # include documentation
|
|
27
24
|
|
|
28
25
|
https://github.com/pry/pry/wiki/Source-browsing#wiki-Show_method
|
|
29
26
|
BANNER
|
|
@@ -31,7 +28,6 @@ class Pry
|
|
|
31
28
|
def options(opt)
|
|
32
29
|
opt.on :e, :eval, "evaluate the command's argument as a ruby " \
|
|
33
30
|
"expression and show the class its return value"
|
|
34
|
-
opt.on :d, :doc, 'include documentation in the output'
|
|
35
31
|
super(opt)
|
|
36
32
|
end
|
|
37
33
|
|
|
@@ -46,73 +42,16 @@ class Pry
|
|
|
46
42
|
|
|
47
43
|
# The source for code_object prepared for display.
|
|
48
44
|
def content_for(code_object)
|
|
49
|
-
content = ''
|
|
50
|
-
if opts.present?(:d)
|
|
51
|
-
code = Code.new(
|
|
52
|
-
render_doc_markup_for(code_object), start_line_for(code_object), :text
|
|
53
|
-
)
|
|
54
|
-
content += code.with_line_numbers(use_line_numbers?).to_s
|
|
55
|
-
content += "\n"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
45
|
code = Code.new(
|
|
59
|
-
code_object.source || [],
|
|
46
|
+
code_object.source || [],
|
|
47
|
+
start_line_for(code_object)
|
|
60
48
|
)
|
|
61
|
-
|
|
62
|
-
content
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# process the markup (if necessary) and apply colors
|
|
66
|
-
def render_doc_markup_for(code_object)
|
|
67
|
-
docs = docs_for(code_object)
|
|
68
|
-
|
|
69
|
-
if code_object.command?
|
|
70
|
-
# command '--help' shouldn't use markup highlighting
|
|
71
|
-
docs
|
|
72
|
-
else
|
|
73
|
-
if docs.empty?
|
|
74
|
-
raise CommandError, "No docs found for: #{obj_name || 'current context'}"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
process_comment_markup(docs)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# Return docs for the code_object, adjusting for whether the code_object
|
|
82
|
-
# has yard docs available, in which case it returns those.
|
|
83
|
-
# (note we only have to check yard docs for modules since they can
|
|
84
|
-
# have multiple docs, but methods can only be doc'd once so we
|
|
85
|
-
# dont need to check them)
|
|
86
|
-
def docs_for(code_object)
|
|
87
|
-
if code_object.module_with_yard_docs?
|
|
88
|
-
# yard docs
|
|
89
|
-
code_object.yard_doc
|
|
90
|
-
else
|
|
91
|
-
# normal docs (i.e comments above method/module/command)
|
|
92
|
-
code_object.doc
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# Which sections to include in the 'header', can toggle: :owner,
|
|
97
|
-
# :signature and visibility.
|
|
98
|
-
def header_options
|
|
99
|
-
super.merge signature: true
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# figure out start line of docs by back-calculating based on
|
|
103
|
-
# number of lines in the comment and the start line of the code_object
|
|
104
|
-
# @return [Fixnum] start line of docs
|
|
105
|
-
def start_line_for(code_object)
|
|
106
|
-
return 1 if code_object.command? || opts.present?(:'base-one')
|
|
107
|
-
return 1 unless code_object.source_line
|
|
108
|
-
|
|
109
|
-
code_object.source_line - code_object.doc.lines.count
|
|
49
|
+
code.with_line_numbers(use_line_numbers?).highlighted
|
|
110
50
|
end
|
|
111
51
|
end
|
|
112
52
|
|
|
113
53
|
Pry::Commands.add_command(Pry::Command::ShowSource)
|
|
114
54
|
Pry::Commands.alias_command 'show-method', 'show-source'
|
|
115
55
|
Pry::Commands.alias_command '$', 'show-source'
|
|
116
|
-
Pry::Commands.alias_command '?', 'show-source -d'
|
|
117
56
|
end
|
|
118
57
|
end
|
data/lib/pry/config.rb
CHANGED
|
@@ -290,14 +290,21 @@ class Pry
|
|
|
290
290
|
require 'readline'
|
|
291
291
|
::Readline
|
|
292
292
|
rescue LoadError
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
293
|
+
begin
|
|
294
|
+
require 'reline'
|
|
295
|
+
::Reline
|
|
296
|
+
rescue LoadError
|
|
297
|
+
output.puts(
|
|
298
|
+
"Sorry, you can't use Pry without Readline or a compatible library. \n" \
|
|
299
|
+
"Possible solutions: \n" \
|
|
300
|
+
" * Rebuild Ruby with Readline support using `--with-readline` \n" \
|
|
301
|
+
" * Use the reline gem \n" \
|
|
302
|
+
" * Use the readline-ext gem \n " \
|
|
303
|
+
" * Use the rb-readline gem, which is a pure-Ruby port of Readline \n" \
|
|
304
|
+
" * Use the pry-coolline gem, a pure-ruby alternative to Readline"
|
|
305
|
+
)
|
|
306
|
+
raise
|
|
307
|
+
end
|
|
301
308
|
end
|
|
302
309
|
|
|
303
310
|
def default_rc_file
|
|
@@ -60,7 +60,7 @@ class Pry
|
|
|
60
60
|
# @return [Pry::Method, nil] The Pry::Method that matches the
|
|
61
61
|
# given binding.
|
|
62
62
|
def find_method
|
|
63
|
-
|
|
63
|
+
find_renamed_method || find_method_in_superclass
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# @return [Boolean] Whether the Pry::Method is unrecoverable
|
|
@@ -97,7 +97,7 @@ class Pry
|
|
|
97
97
|
|
|
98
98
|
def target_line
|
|
99
99
|
if target.respond_to?(:source_location)
|
|
100
|
-
target.source_location
|
|
100
|
+
target.source_location[1]
|
|
101
101
|
else
|
|
102
102
|
target.eval('__LINE__')
|
|
103
103
|
end
|
|
@@ -170,7 +170,7 @@ class Pry
|
|
|
170
170
|
if pry_file?
|
|
171
171
|
source_location
|
|
172
172
|
else
|
|
173
|
-
[File.expand_path(source_location.first), source_location
|
|
173
|
+
[File.expand_path(source_location.first), source_location[1]]
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
176
|
|
data/lib/pry/method.rb
CHANGED
|
@@ -359,7 +359,7 @@ class Pry
|
|
|
359
359
|
# @return [Fixnum, nil] The line of code in `source_file` which begins
|
|
360
360
|
# the method's definition, or `nil` if that information is unavailable.
|
|
361
361
|
def source_line
|
|
362
|
-
source_location.nil? ? nil : source_location
|
|
362
|
+
source_location.nil? ? nil : source_location[1]
|
|
363
363
|
end
|
|
364
364
|
|
|
365
365
|
# @return [Range, nil] The range of lines in `source_file` which contain
|
data/lib/pry/pry_class.rb
CHANGED
|
@@ -294,34 +294,7 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc.
|
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
def self.auto_resize!
|
|
297
|
-
Pry.
|
|
298
|
-
|
|
299
|
-
if !defined?(Readline) || Pry.config.input != Readline
|
|
300
|
-
warn "Sorry, you must be using Readline for Pry.auto_resize! to work."
|
|
301
|
-
return
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
if Readline::VERSION =~ /edit/i
|
|
305
|
-
warn(<<-WARN)
|
|
306
|
-
Readline version #{Readline::VERSION} detected - will not auto_resize! correctly.
|
|
307
|
-
For the fix, use GNU Readline instead:
|
|
308
|
-
https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X
|
|
309
|
-
WARN
|
|
310
|
-
return
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
trap :WINCH do
|
|
314
|
-
begin
|
|
315
|
-
Readline.set_screen_size(*output.size)
|
|
316
|
-
rescue StandardError => e
|
|
317
|
-
warn "\nPry.auto_resize!'s Readline.set_screen_size failed: #{e}"
|
|
318
|
-
end
|
|
319
|
-
begin
|
|
320
|
-
Readline.refresh_line
|
|
321
|
-
rescue StandardError => e
|
|
322
|
-
warn "\nPry.auto_resize!'s Readline.refresh_line failed: #{e}"
|
|
323
|
-
end
|
|
324
|
-
end
|
|
297
|
+
warn "Pry.auto_resize! was experimental and has been removed."
|
|
325
298
|
end
|
|
326
299
|
|
|
327
300
|
# Set all the configurable options back to their default values
|
data/lib/pry/version.rb
CHANGED
|
@@ -130,7 +130,13 @@ class Pry
|
|
|
130
130
|
#
|
|
131
131
|
# @return [Integer] number of lines.
|
|
132
132
|
def number_of_lines_in_first_chunk
|
|
133
|
-
|
|
133
|
+
# Ruby 4.0+ provides more details, including end of method:
|
|
134
|
+
# https://bugs.ruby-lang.org/issues/6012
|
|
135
|
+
end_method_line = if last_method_source_location.size == 5
|
|
136
|
+
last_method_source_location[-2]
|
|
137
|
+
else
|
|
138
|
+
last_method_source_location.last
|
|
139
|
+
end
|
|
134
140
|
|
|
135
141
|
end_method_line - line
|
|
136
142
|
end
|
data/lib/pry.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Mair (banisterfiend)
|
|
8
8
|
- Conrad Irwin
|
|
9
9
|
- Ryan Fitzgerald
|
|
10
10
|
- Kyrylo Silin
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: coderay
|
|
@@ -41,6 +40,20 @@ dependencies:
|
|
|
41
40
|
- - "~>"
|
|
42
41
|
- !ruby/object:Gem::Version
|
|
43
42
|
version: '1.0'
|
|
43
|
+
- !ruby/object:Gem::Dependency
|
|
44
|
+
name: reline
|
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: 0.6.0
|
|
50
|
+
type: :runtime
|
|
51
|
+
prerelease: false
|
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 0.6.0
|
|
44
57
|
description: |
|
|
45
58
|
Pry is a runtime developer console and IRB alternative with powerful
|
|
46
59
|
introspection capabilities. Pry aims to be more than an IRB replacement. It is
|
|
@@ -202,7 +215,6 @@ metadata:
|
|
|
202
215
|
changelog_uri: https://github.com/pry/pry/blob/master/CHANGELOG.md
|
|
203
216
|
source_code_uri: https://github.com/pry/pry
|
|
204
217
|
bug_tracker_uri: https://github.com/pry/pry/issues
|
|
205
|
-
post_install_message:
|
|
206
218
|
rdoc_options: []
|
|
207
219
|
require_paths:
|
|
208
220
|
- lib
|
|
@@ -210,15 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
210
222
|
requirements:
|
|
211
223
|
- - ">="
|
|
212
224
|
- !ruby/object:Gem::Version
|
|
213
|
-
version: '2.
|
|
225
|
+
version: '2.6'
|
|
214
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
227
|
requirements:
|
|
216
228
|
- - ">="
|
|
217
229
|
- !ruby/object:Gem::Version
|
|
218
230
|
version: '0'
|
|
219
231
|
requirements: []
|
|
220
|
-
rubygems_version:
|
|
221
|
-
signing_key:
|
|
232
|
+
rubygems_version: 4.0.3
|
|
222
233
|
specification_version: 4
|
|
223
234
|
summary: A runtime developer console and IRB alternative with powerful introspection
|
|
224
235
|
capabilities.
|