Sha256: 29d94e93cc028fe47af7ebade77f497b5b91d278da13b941f5e7a7199fec437e

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid
  class Criteria
    module Queryable
      module Extensions

        # This module contains additional time with zone behavior.
        module TimeWithZone

          # Evolve the time into a utc time.
          #
          # @example Evolve the time.
          #   time.__evolve_time__
          #
          # @return [ Time ] The time in UTC.
          #
          # @since 1.0.0
          def __evolve_time__
            utc
          end

          module ClassMethods

            # Evolve the object to an date.
            #
            # @example Evolve dates.
            #
            # @example Evolve string dates.
            #
            # @example Evolve date ranges.
            #
            # @param [ Object ] object The object to evolve.
            #
            # @return [ Time ] The evolved date time.
            #
            # @since 1.0.0
            def evolve(object)
              object.__evolve_time__
            end
          end
        end
      end
    end
  end
end

::ActiveSupport::TimeWithZone.__send__(
  :include,
  Mongoid::Criteria::Queryable::Extensions::TimeWithZone
)
::ActiveSupport::TimeWithZone.__send__(
  :extend,
  Mongoid::Criteria::Queryable::Extensions::TimeWithZone::ClassMethods
)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-7.1.2 lib/mongoid/criteria/queryable/extensions/time_with_zone.rb
mongoid-7.1.1 lib/mongoid/criteria/queryable/extensions/time_with_zone.rb
mongoid-7.1.0 lib/mongoid/criteria/queryable/extensions/time_with_zone.rb
mongoid-7.1.0.rc0 lib/mongoid/criteria/queryable/extensions/time_with_zone.rb