Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vistahigherlearning / logstash   deb

Repository URL to install this package:

/ opt / logstash / vendor / bundle / jruby / 1.9 / gems / activesupport-3.2.17 / lib / active_support / core_ext / range / blockless_step.rb

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
    end
  end

  alias_method_chain :step, :blockless
end