Class: Token

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/tokens/token.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanObject


7
8
9
# File 'lib/tokens/token.rb', line 7

def self.clean
  where("expires_at < ? AND expires_at IS NOT NULL", Time.now).delete_all
end

Instance Method Details

#dataObject


11
12
13
# File 'lib/tokens/token.rb', line 11

def data
  read_attribute(:data) || {}
end

#expired?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/tokens/token.rb', line 19

def expired?
  expires_at && expires_at < Time.now
end

#to_sObject


15
16
17
# File 'lib/tokens/token.rb', line 15

def to_s
  token
end