Merge pull request #4183 from nashby/blockless-step-range

remove useless 1.8 ruby code from Range#step
This commit is contained in:
José Valim 2011-12-25 07:56:17 -08:00
commit b0a4487b0e

@ -1,21 +1,6 @@
require 'active_support/core_ext/module/aliasing'
class Range
begin
(1..2).step
# Range#step doesn't return an Enumerator
rescue LocalJumpError
# Return an array when step is called without a block.
def step_with_blockless(*args, &block)
if block_given?
step_without_blockless(*args, &block)
else
array = []
step_without_blockless(*args) { |step| array << step }
array
end
end
else
def step_with_blockless(*args, &block) #:nodoc:
if block_given?
step_without_blockless(*args, &block)
@ -23,7 +8,6 @@ def step_with_blockless(*args, &block) #:nodoc:
step_without_blockless(*args).to_a
end
end
end
alias_method_chain :step, :blockless
end