summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndré Luis Leal Cardoso Junior <andrehjr@gmail.com>2022-06-11 10:27:02 -0300
committerGitHub <noreply@github.com>2022-06-11 10:27:02 -0300
commit6aab1351c919b49011e7fa98b4e5e31f3b5811ed (patch)
tree4c2236e56714695f5cdcec44e1b2db707118a22c /lib
parent8bbbd11dbcf35f38c0a96ea069256a6ece8298f5 (diff)
parent668278cebeffc70f05a36a141f01989ef4934856 (diff)
downloadpry-6aab1351c919b49011e7fa98b4e5e31f3b5811ed.tar.gz
Merge pull request #2239 from andrehjr/drop-ruby-1-9-3
Drop support for Ruby 1.9.x
Diffstat (limited to 'lib')
-rw-r--r--lib/pry/code.rb8
-rw-r--r--lib/pry/warning.rb13
-rw-r--r--lib/pry/wrapped_module.rb9
3 files changed, 5 insertions, 25 deletions
diff --git a/lib/pry/code.rb b/lib/pry/code.rb
index 1fb206c4..3f3f9238 100644
--- a/lib/pry/code.rb
+++ b/lib/pry/code.rb
@@ -346,14 +346,6 @@ class Pry
''.respond_to?(method_name, include_private) || super
end
- if RUBY_VERSION.start_with?('1.9')
- # @todo This is needed for Ruby 1.9 support where `lines` return an
- # Enumerator. Newer Rubies return an Array
- def lines
- super.to_a
- end
- end
-
protected
# An abstraction of the `dup.instance_eval` pattern used throughout this
diff --git a/lib/pry/warning.rb b/lib/pry/warning.rb
index 14c119ed..c65279f7 100644
--- a/lib/pry/warning.rb
+++ b/lib/pry/warning.rb
@@ -10,16 +10,9 @@ class Pry
# @param [String] message
# @return [void]
def self.warn(message)
- if Kernel.respond_to?(:caller_locations)
- location = caller_locations(2..2).first
- path = location.path
- lineno = location.lineno
- else
- # Ruby 1.9.3 support.
- frame = caller[1].split(':') # rubocop:disable Performance/Caller
- path = frame.first
- lineno = frame[1]
- end
+ location = caller_locations(2..2).first
+ path = location.path
+ lineno = location.lineno
Kernel.warn("#{path}:#{lineno}: warning: #{message}")
end
diff --git a/lib/pry/wrapped_module.rb b/lib/pry/wrapped_module.rb
index c07ba682..89173dcd 100644
--- a/lib/pry/wrapped_module.rb
+++ b/lib/pry/wrapped_module.rb
@@ -246,19 +246,14 @@ class Pry
method_candidates.count
end
- # @note On JRuby 1.9 and higher, in certain conditions, this method chucks
- # away its ability to be quick (when there are lots of monkey patches,
- # like in Rails). However, it should be efficient enough on other rubies.
- # @see https://github.com/jruby/jruby/issues/525
- # @return [Enumerator, Array] on JRuby 1.9 and higher returns Array, on
- # other rubies returns Enumerator
+ # @return [Array]
def candidates
enum = Enumerator.new do |y|
(0...number_of_candidates).each do |num|
y.yield candidate(num)
end
end
- Helpers::Platform.jruby_19? ? enum.to_a : enum
+ enum
end
# @return [Boolean] Whether YARD docs are available for this module.