Open tcrayford opened 13 years ago
Inside the following method:
def validate(numbers) bar = 1 numbers.any? do |n| n < 0 end end
,with
numbers.any? do |n| n < 0 end
When I do extract method, and give the new method a name of "check_numbers", I get the following:
def check_numbers(n,numbers) numbers.any? do |n| n < 0 end end def validate(numbers) bar = 1 check_numbers(n,numbers) end
Instead, I expect:
def validate(numbers) bar = 1 check_numbers(numbers) end def check_numbers(numbers) numbers.any? do |n| n < 0 end end
Note that the temp is needed here, without it, the refactoring works as expected.
Cheers Tom, I'll take a look at this one
Inside the following method:
,with
numbers.any? do |n| n < 0 end
When I do extract method, and give the new method a name of "check_numbers", I get the following:
Instead, I expect: