Sha256: 5b684eca1a1d1115a4ddbb41bd55a39197259ab6bf73bccc84f3b16274f4910b
Contents?: true
Size: 898 Bytes
Versions: 15
Compression:
Stored size: 898 Bytes
Contents
module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Range #:nodoc: # Return an array when step is called without a block. module BlocklessStep def self.included(base) #:nodoc: base.alias_method_chain :step, :blockless end if RUBY_VERSION < '1.9' def step_with_blockless(value = 1, &block) if block_given? step_without_blockless(value, &block) else [].tap do |array| step_without_blockless(value) { |step| array << step } end end end else def step_with_blockless(value = 1, &block) if block_given? step_without_blockless(value, &block) else step_without_blockless(value).to_a end end end end end end end
Version data entries
15 entries across 15 versions & 4 rubygems