pry 0.14.1-java → 0.15.0-java

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -2
  3. data/README.md +47 -30
  4. data/lib/pry/basic_object.rb +1 -1
  5. data/lib/pry/class_command.rb +2 -2
  6. data/lib/pry/cli.rb +6 -2
  7. data/lib/pry/code.rb +0 -8
  8. data/lib/pry/code_object.rb +2 -2
  9. data/lib/pry/command.rb +1 -1
  10. data/lib/pry/command_set.rb +2 -2
  11. data/lib/pry/command_state.rb +11 -6
  12. data/lib/pry/commands/amend_line.rb +1 -1
  13. data/lib/pry/commands/cd.rb +2 -0
  14. data/lib/pry/commands/edit.rb +2 -0
  15. data/lib/pry/commands/find_method.rb +1 -1
  16. data/lib/pry/commands/ls/config.rb +51 -0
  17. data/lib/pry/commands/ls/constants.rb +2 -2
  18. data/lib/pry/commands/ls.rb +0 -21
  19. data/lib/pry/commands/raise_up.rb +1 -1
  20. data/lib/pry/commands/ri.rb +1 -1
  21. data/lib/pry/commands/shell_command.rb +1 -1
  22. data/lib/pry/commands/shell_mode.rb +1 -0
  23. data/lib/pry/commands/watch_expression/expression.rb +1 -1
  24. data/lib/pry/commands/watch_expression.rb +4 -6
  25. data/lib/pry/config.rb +26 -29
  26. data/lib/pry/control_d_handler.rb +1 -1
  27. data/lib/pry/core_extensions.rb +1 -1
  28. data/lib/pry/editor.rb +3 -1
  29. data/lib/pry/exception_handler.rb +7 -2
  30. data/lib/pry/helpers/command_helpers.rb +1 -1
  31. data/lib/pry/helpers/platform.rb +1 -6
  32. data/lib/pry/helpers/text.rb +5 -5
  33. data/lib/pry/indent.rb +13 -11
  34. data/lib/pry/input/simple_stdio.rb +13 -0
  35. data/lib/pry/input_completer.rb +2 -2
  36. data/lib/pry/method/patcher.rb +2 -2
  37. data/lib/pry/method/weird_method_locator.rb +2 -2
  38. data/lib/pry/method.rb +4 -4
  39. data/lib/pry/pry_class.rb +17 -2
  40. data/lib/pry/pry_instance.rb +7 -45
  41. data/lib/pry/repl.rb +66 -4
  42. data/lib/pry/ring.rb +2 -2
  43. data/lib/pry/slop.rb +1 -1
  44. data/lib/pry/syntax_highlighter.rb +1 -1
  45. data/lib/pry/version.rb +1 -1
  46. data/lib/pry/warning.rb +3 -10
  47. data/lib/pry/wrapped_module/candidate.rb +9 -8
  48. data/lib/pry/wrapped_module.rb +3 -8
  49. data/lib/pry.rb +3 -0
  50. 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` elemens.
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 programatically. Do note though that with this method, you're
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
  #
@@ -11,7 +11,7 @@ class Pry
11
11
  end
12
12
 
13
13
  def self.tokenize(code, language = :ruby)
14
- CodeRay.scan(code, language)
14
+ CodeRay::Scanners[language].new(code).tokens
15
15
  end
16
16
 
17
17
  def self.keyword_token_color
data/lib/pry/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Pry
4
- VERSION = '0.14.1'.freeze
4
+ VERSION = '0.15.0'.freeze
5
5
  end
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
- if Kernel.respond_to?(:caller_locations)
14
- location = caller_locations(2..2).first
15
- path = location.path
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 = [:lines_for_file, :method_candidates, :yard_docs?, :name]
24
- public_delegates = [:wrapped, :module?, :class?, :nonblank_name,
25
- :number_of_candidates]
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| class_regexes.any? { |r| r =~ v } } + 1
101
+ searchable_lines.rindex { |v| module_definition_first_line?(v) } + 1
102
102
  end
103
103
 
104
- def class_regexes
104
+ def module_definition_first_line?(line)
105
105
  mod_type_string = wrapped.class.to_s.downcase
106
- [/(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped.name.split(/::/).last}/,
107
- /^\s*(::)?#{wrapped.name.split(/::/).last}\s*?=\s*?#{wrapped.class}/,
108
- /^\s*(::)?#{wrapped.name.split(/::/).last}\.(class|instance)_eval/]
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
@@ -246,19 +246,14 @@ class Pry
246
246
  method_candidates.count
247
247
  end
248
248
 
249
- # @note On JRuby 1.9 and higher, in certain conditions, this method chucks
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
- Helpers::Platform.jruby_19? ? enum.to_a : enum
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 absense of a suitable candidate, 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.14.1
4
+ version: 0.15.0
5
5
  platform: java
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: 2021-04-12 00:00:00.000000000 Z
13
+ date: 2024-11-15 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: coderay
@@ -116,6 +115,7 @@ files:
116
115
  - lib/pry/commands/jump_to.rb
117
116
  - lib/pry/commands/list_inspectors.rb
118
117
  - lib/pry/commands/ls.rb
118
+ - lib/pry/commands/ls/config.rb
119
119
  - lib/pry/commands/ls/constants.rb
120
120
  - lib/pry/commands/ls/formatter.rb
121
121
  - lib/pry/commands/ls/globals.rb
@@ -174,6 +174,7 @@ files:
174
174
  - lib/pry/history.rb
175
175
  - lib/pry/hooks.rb
176
176
  - lib/pry/indent.rb
177
+ - lib/pry/input/simple_stdio.rb
177
178
  - lib/pry/input_completer.rb
178
179
  - lib/pry/input_lock.rb
179
180
  - lib/pry/inspector.rb
@@ -214,7 +215,6 @@ metadata:
214
215
  changelog_uri: https://github.com/pry/pry/blob/master/CHANGELOG.md
215
216
  source_code_uri: https://github.com/pry/pry
216
217
  bug_tracker_uri: https://github.com/pry/pry/issues
217
- post_install_message:
218
218
  rdoc_options: []
219
219
  require_paths:
220
220
  - lib
@@ -222,15 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - - ">="
224
224
  - !ruby/object:Gem::Version
225
- version: 1.9.3
225
+ version: '2.0'
226
226
  required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
228
  - - ">="
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.1.2
233
- signing_key:
232
+ rubygems_version: 3.6.0.dev
234
233
  specification_version: 4
235
234
  summary: A runtime developer console and IRB alternative with powerful introspection
236
235
  capabilities.