aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/range/each.rb
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2017-11-09 13:50:50 +0000
committerGitHub <noreply@github.com>2017-11-09 13:50:50 +0000
commiteae65ac2ab7e7a8155fa5a76c15f21cee09499c2 (patch)
treeb6ed0736858d7b68c68bff3d12f00293402d6d7e /activesupport/lib/active_support/core_ext/range/each.rb
parent518959d0127aac81020ccd50f3dc425f857e6715 (diff)
parent2b434d6f79813dcad162b158fd2b60e34a725ba1 (diff)
downloadrails-eae65ac2ab7e7a8155fa5a76c15f21cee09499c2.tar.gz
rails-eae65ac2ab7e7a8155fa5a76c15f21cee09499c2.tar.bz2
rails-eae65ac2ab7e7a8155fa5a76c15f21cee09499c2.zip
Merge pull request #31081 from rails/allow-include-time-with-zone-range
Allow `Range#include?` on TWZ ranges
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range/each.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/range/each.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/each.rb b/activesupport/lib/active_support/core_ext/range/each.rb
index cdff6393d7..2f22cd0e92 100644
--- a/activesupport/lib/active_support/core_ext/range/each.rb
+++ b/activesupport/lib/active_support/core_ext/range/each.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "active_support/time_with_zone"
+
module ActiveSupport
module EachTimeWithZone #:nodoc:
def each(&block)
@@ -15,7 +17,7 @@ module ActiveSupport
private
def ensure_iteration_allowed
- raise TypeError, "can't iterate from #{first.class}" if first.is_a?(Time)
+ raise TypeError, "can't iterate from #{first.class}" if first.is_a?(TimeWithZone)
end
end
end