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

Fix possible reference to past scope warnings

This type of warning was introduced in Ruby 2.2
This commit is contained in:
Matijs van Zuijlen 2015-01-23 14:24:35 +01:00
parent efd0ed82d3
commit 5e8d69e8b3
5 changed files with 21 additions and 23 deletions

View file

@ -10,17 +10,17 @@ class Pry
end
command "get-naked", "" do
text = %{
txt = %{
--
We dont have to take our clothes off to have a good time.
We could dance & party all night And drink some cherry wine.
-- Jermaine Stewart }
output.puts text
text
output.puts txt
txt
end
command "east-coker", "" do
text = %{
txt = %{
--
Now the light falls
Across the open field, leaving the deep lane
@ -34,12 +34,12 @@ class Pry
Wait for the early owl.
-- T.S Eliot
}
output.puts text
text
output.puts txt
txt
end
command "cohen-poem", "" do
text = %{
txt = %{
--
When this American woman,
whose thighs are bound in casual red cloth,
@ -57,8 +57,8 @@ class Pry
they are lost for hours.
-- Leonard Cohen
}
output.puts text
text
output.puts txt
txt
end
command "pessoa-poem", "" do

View file

@ -359,13 +359,13 @@ class Pry
# Paraphrased from `awesome_print` gem.
def signature
if respond_to?(:parameters)
args = parameters.inject([]) do |arr, (type, name)|
name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
arr << case type
when :req then name.to_s
when :opt then "#{name}=?"
when :rest then "*#{name}"
when :block then "&#{name}"
args = parameters.inject([]) do |arr, (typ, nam)|
nam ||= (typ == :block ? 'block' : "arg#{arr.size + 1}")
arr << case typ
when :req then nam.to_s
when :opt then "#{nam}=?"
when :rest then "*#{nam}"
when :block then "&#{nam}"
else '?'
end
end

View file

@ -174,8 +174,8 @@ class Pry
completions.compact
end
elsif input.respond_to? :completion_proc=
input.completion_proc = proc do |input|
@pry.complete input
input.completion_proc = proc do |inp|
@pry.complete inp
end
end

View file

@ -414,13 +414,11 @@ describe "commands" do
end
end
output = StringIO.new
redirect_pry_io(InputTester.new('def yo', 'hello'), output) do
redirect_pry_io(InputTester.new('def yo', 'hello'), @str_output) do
Pry.start self, :commands => klass
end
output.string.should =~ /6/
@str_output.string.should =~ /6/
end
it 'a command (with :keep_retval => true) that replaces eval_string with a valid expression should overwrite the eval_string with the return value' do

View file

@ -13,7 +13,7 @@ describe "Prompts" do
it 'should get full config object, when using a proc array' do
config1 = nil
redirect_pry_io(InputTester.new("exit-all")) do
Pry.start(self, :prompt => [proc { |v| config1 = v }, proc { |_v| _config2 = v }])
Pry.start(self, :prompt => [proc { |v| config1 = v }, proc { |v| _config2 = v }])
end
config1.is_a?(Pry::Config).should eq true
end