Class: Gringotts::Code

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/gringotts/code.rb

Instance Method Summary collapse

Instance Method Details

#generate_value(places = 5) ⇒ Object


12
13
14
# File 'app/models/gringotts/code.rb', line 12

def generate_value(places = 5)
  self.value ||= places.times.map { Random.rand(10) }.join("")
end

#set_expires_at(expires = (Time.now + 5.minutes)) ⇒ Object


16
17
18
# File 'app/models/gringotts/code.rb', line 16

def set_expires_at(expires = (Time.now + 5.minutes))
  self.expires_at ||= expires
end