Sha256: 0f6385422aa8f95afecaeb830e2bdd1405baa74b2e2e939981c5227b02d680b7

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 Bytes

Contents

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

    attribute :last_performed_at, Type::Time

    index :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
      alias_method :last_performed_at?, :last_performed_at
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troo-0.0.10 lib/troo/models/refresh.rb
troo-0.0.9 lib/troo/models/refresh.rb