Sha256: d0b374d0ef562b656f6da294009a49df70462250a8127c53568f4bd1a017cf6e

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 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
      # @return []
      def completed!
        all.map { |record| record.delete }
        create(last_performed_at: Time.now.to_s)
      end

      # @return []
      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

1 entries across 1 versions & 1 rubygems

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