aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2011-12-25 18:22:54 +0300
committerVasiliy Ermolovich <younash@gmail.com>2011-12-25 18:22:54 +0300
commit434c691df6d101c840f6be3b44388c208c8f69bf (patch)
tree8a58fb06ae0514e4fbe84793a90e2a2944f42f69 /activesupport
parent54e522a38827b7b78968237a762334f94c20f7d7 (diff)
downloadrails-434c691df6d101c840f6be3b44388c208c8f69bf.tar.gz
rails-434c691df6d101c840f6be3b44388c208c8f69bf.tar.bz2
rails-434c691df6d101c840f6be3b44388c208c8f69bf.zip
remove useless 1.8 ruby code from Range#step, because Range#step without block always returns enumerator
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/range/blockless_step.rb26
1 files changed, 5 insertions, 21 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/blockless_step.rb b/activesupport/lib/active_support/core_ext/range/blockless_step.rb
index db42ef5c47..f687287f0d 100644
--- a/activesupport/lib/active_support/core_ext/range/blockless_step.rb
+++ b/activesupport/lib/active_support/core_ext/range/blockless_step.rb
@@ -1,27 +1,11 @@
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)
- else
- step_without_blockless(*args).to_a
- end
+ def step_with_blockless(*args, &block) #:nodoc:
+ if block_given?
+ step_without_blockless(*args, &block)
+ else
+ step_without_blockless(*args).to_a
end
end