Sha256: 5407e6f86ab1227250126c73d4f1d889fb2fd3fa10ec204d71af0eab23bbaac2

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

module ChronoModel

  # Provides the TimeMachine API to non-temporal models that associate
  # temporal ones.
  #
  module TimeGate
    extend ActiveSupport::Concern

    include ChronoModel::Patches::AsOfTimeHolder

    module ClassMethods
      include ChronoModel::TimeMachine::Timeline

      def as_of(time)
        all.as_of_time!(time)
      end
    end

    def as_of(time)
      self.class.as_of(time).where(id: self.id).first!
    end

    def timeline
      self.class.timeline(self)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chrono_model-1.2.2 lib/chrono_model/time_gate.rb
chrono_model-1.2.1 lib/chrono_model/time_gate.rb
chrono_model-1.2.0 lib/chrono_model/time_gate.rb
chrono_model-1.1.0 lib/chrono_model/time_gate.rb