1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Don't attempt to read unused proc parameters

This commit is contained in:
Kyrylo Silin 2018-11-11 20:28:42 +08:00
parent 0fc57889a1
commit 22d4ff7b22
5 changed files with 10 additions and 10 deletions

View file

@ -191,7 +191,7 @@ Pry::CLI.add_options do
Pry.config.requires << file
end
on :I=, "Add a path to the $LOAD_PATH", as: Array, delimiter: ":" do |load_path|
on(:I=, "Add a path to the $LOAD_PATH", as: Array, delimiter: ":") do
load_path.map! do |path|
/\A\.\// =~ path ? path : File.expand_path(path)
end

View file

@ -163,8 +163,8 @@ class Pry
def eager_load!
default = @default
while default
default.memoized_methods.each { |_method| self[key] = default.public_send(key) } if default.respond_to?(:memoized_methods)
while default && default.respond_to?(:memoized_methods)
default.memoized_methods.each { self[key] = default.public_send(key) }
default = @default.default
end
end

View file

@ -45,7 +45,7 @@ class Pry::Slop
integer: proc { |v| value_to_integer(v) },
float: proc { |v| value_to_float(v) },
range: proc { |v| value_to_range(v) },
count: proc { |_v| @count }
count: proc { @count }
}
if long && long.size > @slop.config[:longest_flag]

View file

@ -30,19 +30,19 @@ describe Pry::Code do
end
specify 'check for files relative to origin pwd' do
Dir.chdir('spec') do |_f|
Dir.chdir('spec') do
expect(Pry::Code.from_file('spec/' + File.basename(__FILE__)).code_type).to eq :ruby
end
end
specify 'check for Ruby files relative to origin pwd with `.rb` omitted' do
Dir.chdir('spec') do |_f|
Dir.chdir('spec') do
expect(Pry::Code.from_file('spec/' + File.basename(__FILE__, '.*')).code_type).to eq :ruby
end
end
specify 'find files that are relative to the current working directory' do
Dir.chdir('spec') do |_f|
Dir.chdir('spec') do
expect(Pry::Code.from_file(File.basename(__FILE__)).code_type).to eq :ruby
end
end

View file

@ -7,19 +7,19 @@ describe Pry do
end
it "should catch serialization exceptions" do
Pry.config.print = lambda { |*_a| raise "catch-22" }
Pry.config.print = proc { raise "catch-22" }
expect { mock_pry("1") }.to_not raise_error
end
it "should display serialization exceptions" do
Pry.config.print = lambda { |*_a| raise "catch-22" }
Pry.config.print = proc { raise "catch-22" }
expect(mock_pry("1")).to match(/\(pry\) output error: #<RuntimeError: catch-22>/)
end
it "should catch errors serializing exceptions" do
Pry.config.print = lambda do |*_a|
Pry.config.print = proc do
ex = Exception.new("catch-22")
class << ex
def inspect; raise ex; end