Sha256: 598a674cebb8db9e6b89519e2135a26706f60fdec3dd74b9fc3639c840e7310e

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

module Troo
  class Refresh < Ohm::Model
    include Ohm::DataTypes
    include ModelHelpers

    attribute :last_performed_at, Type::Time

    index :last_performed_at

    alias_method :last_performed_at?, :last_performed_at

    class << self
      def completed!
        all.map { |record| record.delete }
        create(last_performed_at: Time.now.to_s)
      end

      def last_performed_at?
        first ? first.last_performed_at? : nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/models/refresh.rb