Sha256: 582d6e77ff7dcff3114db97166f48fff979d0e51d1d8899ebcf5886338036068

Contents?: true

Size: 478 Bytes

Versions: 6

Compression:

Stored size: 478 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

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/models/refresh.rb
troo-0.0.6 lib/troo/models/refresh.rb
troo-0.0.5 lib/troo/models/refresh.rb
troo-0.0.4 lib/troo/models/refresh.rb
troo-0.0.3 lib/troo/models/refresh.rb
troo-0.0.2 lib/troo/models/refresh.rb