From 22d4ff7b22e2d2b7f49c0d883fcaefd329d2d947 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Sun, 11 Nov 2018 20:28:42 +0800 Subject: [PATCH] Don't attempt to read unused proc parameters --- lib/pry/cli.rb | 2 +- lib/pry/config/behavior.rb | 4 ++-- lib/pry/slop/option.rb | 2 +- spec/code_spec.rb | 6 +++--- spec/pry_output_spec.rb | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index 8edf5d3d..a694ee7a 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -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 diff --git a/lib/pry/config/behavior.rb b/lib/pry/config/behavior.rb index e8050ac3..8bb68f05 100644 --- a/lib/pry/config/behavior.rb +++ b/lib/pry/config/behavior.rb @@ -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 diff --git a/lib/pry/slop/option.rb b/lib/pry/slop/option.rb index 5d7707c7..8fe4cce8 100644 --- a/lib/pry/slop/option.rb +++ b/lib/pry/slop/option.rb @@ -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] diff --git a/spec/code_spec.rb b/spec/code_spec.rb index f24731c8..00249dcf 100644 --- a/spec/code_spec.rb +++ b/spec/code_spec.rb @@ -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 diff --git a/spec/pry_output_spec.rb b/spec/pry_output_spec.rb index a4168b83..b200adf7 100644 --- a/spec/pry_output_spec.rb +++ b/spec/pry_output_spec.rb @@ -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: #/) 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