Sha256: 84e825a1dcbaa2d87e6dcece4728fdd5856d2b12ff27814965b2d2331f7ab72d

Contents?: true

Size: 486 Bytes

Versions: 68

Compression:

Stored size: 486 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

68 entries across 68 versions & 9 rubygems

Version Path
activesupport-6.1.7.10 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.9 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.8 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.7 lib/active_support/core_ext/range/each.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.6 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.5 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.4 lib/active_support/core_ext/range/each.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/core_ext/range/each.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.3 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.2 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7.1 lib/active_support/core_ext/range/each.rb
activesupport-6.0.6.1 lib/active_support/core_ext/range/each.rb
activesupport-6.1.7 lib/active_support/core_ext/range/each.rb
activesupport-6.0.6 lib/active_support/core_ext/range/each.rb
activesupport-6.1.6.1 lib/active_support/core_ext/range/each.rb
activesupport-6.0.5.1 lib/active_support/core_ext/range/each.rb
activesupport-6.0.5 lib/active_support/core_ext/range/each.rb