Sha256: f7f358b11abf62f5f96bfcd909be62f87d414c606872e9413e4a48aeee509b2f

Contents?: true

Size: 487 Bytes

Versions: 92

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

92 entries across 88 versions & 14 rubygems

Version Path
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.6/lib/active_support/core_ext/range/each.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5/lib/active_support/core_ext/range/each.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.6/lib/active_support/core_ext/range/each.rb
activesupport-7.0.6 lib/active_support/core_ext/range/each.rb
activesupport-7.0.5.1 lib/active_support/core_ext/range/each.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-7.0.2.3/lib/active_support/core_ext/range/each.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/core_ext/range/each.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/each.rb
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5/lib/active_support/core_ext/range/each.rb
activesupport-7.0.5 lib/active_support/core_ext/range/each.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/activesupport-7.0.4.3/lib/active_support/core_ext/range/each.rb
activesupport-7.0.4.3 lib/active_support/core_ext/range/each.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/each.rb
activesupport-7.0.4.2 lib/active_support/core_ext/range/each.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/each.rb
activesupport-7.0.4.1 lib/active_support/core_ext/range/each.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/each.rb
activesupport-7.0.4 lib/active_support/core_ext/range/each.rb
activesupport-7.0.3.1 lib/active_support/core_ext/range/each.rb
activesupport-7.0.3 lib/active_support/core_ext/range/each.rb