Sha256: b1045c27c5b5a0e1cdfe9129ed70ee3216b9daad533471c7e3c4961d814774f5

Contents?: true

Size: 487 Bytes

Versions: 73

Compression:

Stored size: 487 Bytes

Contents

# frozen_string_literal: true

require "active_support/time_with_zone"

module ActiveSupport
  module EachTimeWithZone #:nodoc:
    def each(&block)
      ensure_iteration_allowed
      super
    end

    def step(n = 1, &block)
      ensure_iteration_allowed
      super
    end

    private

      def ensure_iteration_allowed
        raise TypeError, "can't iterate from #{first.class}" if first.is_a?(TimeWithZone)
      end
  end
end

Range.prepend(ActiveSupport::EachTimeWithZone)

Version data entries

73 entries across 65 versions & 10 rubygems

Version Path
activesupport-5.2.4.1 lib/active_support/core_ext/range/each.rb
activesupport-6.0.2 lib/active_support/core_ext/range/each.rb
activesupport-6.0.2.rc2 lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb
activesupport-5.2.4 lib/active_support/core_ext/range/each.rb
activesupport-6.0.2.rc1 lib/active_support/core_ext/range/each.rb
activesupport-5.2.4.rc1 lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/each.rb
activesupport-6.0.1 lib/active_support/core_ext/range/each.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb
activesupport-6.0.1.rc1 lib/active_support/core_ext/range/each.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/range/each.rb