Sha256: dc65a9bfaff8cc82bf541ebd33b4ac8581483790769f4e5d04c02ddd409e55e8

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

# frozen_string_literal: true

module ChronoModel
  module Patches
    # Added to classes that need to carry the As-Of date around
    #
    module AsOfTimeHolder
      # Sets the virtual 'as_of_time' attribute to the given time, converting to UTC.
      #
      def as_of_time!(time)
        @_as_of_time = time.utc

        self
      end

      # Reads the virtual 'as_of_time' attribute
      #
      def as_of_time
        @_as_of_time
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chrono_model-3.0.1 lib/chrono_model/patches/as_of_time_holder.rb
chrono_model-2.0.0 lib/chrono_model/patches/as_of_time_holder.rb