Class: Cats::Core::Util
- Inherits:
-
Object
- Object
- Cats::Core::Util
- Defined in:
- app/utils/cats/core/util.rb
Class Method Summary collapse
Class Method Details
.generate_pin(obj) ⇒ Object
8 9 10 11 12 |
# File 'app/utils/cats/core/util.rb', line 8 def self.generate_pin(obj) pin = SecureRandom.hex(10) obj.auth_details = {pin: pin, active: true, expires_at: DateTime.now + 24.hour} obj.save! end |
.send_chain(obj, arr) ⇒ Object
4 5 6 |
# File 'app/utils/cats/core/util.rb', line 4 def self.send_chain(obj, arr) arr.inject(obj) { |o, a| o.send(a) } end |