Sha256: 2935b88bd4f88768ce8ff71b10fcb47095033fb91619c3e8a54dcbe3719586b8
Contents?: true
Size: 539 Bytes
Versions: 62
Compression:
Stored size: 539 Bytes
Contents
# frozen_string_literal: true require "active_support/time_with_zone" module ActiveSupport module IncludeTimeWithZone #:nodoc: # Extends the default Range#include? to support ActiveSupport::TimeWithZone. # # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true # def include?(value) if first.is_a?(TimeWithZone) cover?(value) elsif last.is_a?(TimeWithZone) cover?(value) else super end end end end Range.prepend(ActiveSupport::IncludeTimeWithZone)
Version data entries
62 entries across 56 versions & 8 rubygems
Version | Path |
---|---|
activesupport-5.2.0.beta2 | lib/active_support/core_ext/range/include_time_with_zone.rb |
activesupport-5.2.0.beta1 | lib/active_support/core_ext/range/include_time_with_zone.rb |