pry 0.14.1 → 0.15.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 +68 -2
- data/README.md +47 -30
- data/lib/pry/basic_object.rb +1 -1
- data/lib/pry/class_command.rb +2 -2
- data/lib/pry/cli.rb +6 -2
- data/lib/pry/code.rb +0 -8
- data/lib/pry/code_object.rb +2 -2
- data/lib/pry/command.rb +1 -1
- data/lib/pry/command_set.rb +2 -2
- data/lib/pry/command_state.rb +11 -6
- data/lib/pry/commands/amend_line.rb +1 -1
- data/lib/pry/commands/cd.rb +2 -0
- data/lib/pry/commands/edit.rb +2 -0
- data/lib/pry/commands/find_method.rb +1 -1
- data/lib/pry/commands/ls/config.rb +51 -0
- data/lib/pry/commands/ls/constants.rb +2 -2
- data/lib/pry/commands/ls.rb +0 -21
- data/lib/pry/commands/raise_up.rb +1 -1
- data/lib/pry/commands/ri.rb +1 -1
- data/lib/pry/commands/shell_command.rb +1 -1
- data/lib/pry/commands/shell_mode.rb +1 -0
- data/lib/pry/commands/watch_expression/expression.rb +1 -1
- data/lib/pry/commands/watch_expression.rb +4 -6
- data/lib/pry/config.rb +26 -29
- data/lib/pry/control_d_handler.rb +1 -1
- data/lib/pry/core_extensions.rb +1 -1
- data/lib/pry/editor.rb +3 -1
- data/lib/pry/exception_handler.rb +7 -2
- data/lib/pry/helpers/command_helpers.rb +1 -1
- data/lib/pry/helpers/platform.rb +1 -6
- data/lib/pry/helpers/text.rb +5 -5
- data/lib/pry/indent.rb +13 -11
- data/lib/pry/input/simple_stdio.rb +13 -0
- data/lib/pry/input_completer.rb +2 -2
- data/lib/pry/method/patcher.rb +2 -2
- data/lib/pry/method/weird_method_locator.rb +2 -2
- data/lib/pry/method.rb +4 -4
- data/lib/pry/pry_class.rb +17 -2
- data/lib/pry/pry_instance.rb +7 -45
- data/lib/pry/repl.rb +66 -4
- data/lib/pry/ring.rb +2 -2
- data/lib/pry/slop.rb +1 -1
- data/lib/pry/syntax_highlighter.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 +3 -8
- data/lib/pry.rb +3 -0
- metadata +6 -7
data/lib/pry/ring.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
class Pry
|
4
4
|
# A ring is a thread-safe fixed-capacity array to which you can only add
|
5
5
|
# elements. Older entries are overwritten as you add new elements, so that the
|
6
|
-
# ring can never contain more than `max_size`
|
6
|
+
# ring can never contain more than `max_size` elements.
|
7
7
|
#
|
8
8
|
# @example
|
9
9
|
# ring = Pry::Ring.new(3)
|
@@ -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/slop.rb
CHANGED
@@ -73,7 +73,7 @@ class Pry
|
|
73
73
|
# Build a Slop object from a option specification.
|
74
74
|
#
|
75
75
|
# This allows you to design your options via a simple String rather
|
76
|
-
# than
|
76
|
+
# than programmatically. Do note though that with this method, you're
|
77
77
|
# unable to pass any advanced options to the on() method when creating
|
78
78
|
# options.
|
79
79
|
#
|
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.
|
@@ -291,7 +286,7 @@ class Pry
|
|
291
286
|
# highest rank, that is the 'monkey patch' of this module with the
|
292
287
|
# highest number of methods, which contains a source code line that
|
293
288
|
# defines the module. It is considered the 'canonical' definition
|
294
|
-
# for the module. In the
|
289
|
+
# for the module. In the absence of a suitable candidate, the
|
295
290
|
# candidate of rank 0 will be returned, or a CommandError raised if
|
296
291
|
# there are no candidates at all.
|
297
292
|
def primary_candidate
|
data/lib/pry.rb
CHANGED
@@ -34,6 +34,7 @@ require 'pry/env'
|
|
34
34
|
|
35
35
|
Pry::Commands = Pry::CommandSet.new unless defined?(Pry::Commands)
|
36
36
|
|
37
|
+
require 'pry/commands/ls/config'
|
37
38
|
require 'pry/commands/ls/jruby_hacks'
|
38
39
|
require 'pry/commands/ls/methods_helper'
|
39
40
|
require 'pry/commands/ls/interrogatable'
|
@@ -57,6 +58,8 @@ require 'pry/config/memoized_value'
|
|
57
58
|
require 'pry/config/lazy_value'
|
58
59
|
require 'pry/config'
|
59
60
|
|
61
|
+
require 'pry/input/simple_stdio'
|
62
|
+
|
60
63
|
require 'pry/pry_class'
|
61
64
|
require 'pry/pry_instance'
|
62
65
|
require 'pry/inspector'
|
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.15.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: 2024-11-15 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: coderay
|
@@ -102,6 +101,7 @@ files:
|
|
102
101
|
- lib/pry/commands/jump_to.rb
|
103
102
|
- lib/pry/commands/list_inspectors.rb
|
104
103
|
- lib/pry/commands/ls.rb
|
104
|
+
- lib/pry/commands/ls/config.rb
|
105
105
|
- lib/pry/commands/ls/constants.rb
|
106
106
|
- lib/pry/commands/ls/formatter.rb
|
107
107
|
- lib/pry/commands/ls/globals.rb
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/pry/history.rb
|
161
161
|
- lib/pry/hooks.rb
|
162
162
|
- lib/pry/indent.rb
|
163
|
+
- lib/pry/input/simple_stdio.rb
|
163
164
|
- lib/pry/input_completer.rb
|
164
165
|
- lib/pry/input_lock.rb
|
165
166
|
- lib/pry/inspector.rb
|
@@ -200,7 +201,6 @@ metadata:
|
|
200
201
|
changelog_uri: https://github.com/pry/pry/blob/master/CHANGELOG.md
|
201
202
|
source_code_uri: https://github.com/pry/pry
|
202
203
|
bug_tracker_uri: https://github.com/pry/pry/issues
|
203
|
-
post_install_message:
|
204
204
|
rdoc_options: []
|
205
205
|
require_paths:
|
206
206
|
- lib
|
@@ -208,15 +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.
|
219
|
-
signing_key:
|
218
|
+
rubygems_version: 3.6.0.dev
|
220
219
|
specification_version: 4
|
221
220
|
summary: A runtime developer console and IRB alternative with powerful introspection
|
222
221
|
capabilities.
|