From d556f466079d329ee678afe0c11db914894cb4b0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 9 Oct 2007 07:49:16 +0000 Subject: Style update for new Range extensions git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7818 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../active_support/core_ext/range/blockless_step.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/range/blockless_step.rb') 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 4d5e27457b..bc69263abb 100644 --- a/activesupport/lib/active_support/core_ext/range/blockless_step.rb +++ b/activesupport/lib/active_support/core_ext/range/blockless_step.rb @@ -1,25 +1,22 @@ module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Range #:nodoc: - # Return and array when step is called without a block + # Return an array when step is called without a block. module BlocklessStep + def self.included(base) #:nodoc: + base.alias_method_chain :step, :blockless + end - def self.included(klass) #:nodoc: - klass.send(:alias_method, :step_with_block, :step) - klass.send(:alias_method, :step, :step_without_block) - end - - def step_without_block(value, &block) + def step_with_blockless(value, &block) if block_given? - step_with_block(value, &block) + step_without_blockless(value, &block) else returning [] do |array| - step_with_block(value) {|step| array << step } + step_without_blockless(value) { |step| array << step } end end end - end end end -end \ No newline at end of file +end -- cgit v1.2.3