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.6 lib/active_support/core_ext/range/each.rb
activesupport-6.1.5.1 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.8 lib/active_support/core_ext/range/each.rb
activesupport-6.1.5 lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.7 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.7 lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.6 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.6 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.5 lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.5 lib/active_support/core_ext/range/each.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/each.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/each.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/each.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.4 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.4 lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.3 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.3 lib/active_support/core_ext/range/each.rb
activesupport-6.0.4.2 lib/active_support/core_ext/range/each.rb
activesupport-6.1.4.2 lib/active_support/core_ext/range/each.rb