Class: Orthoses::ActiveRecord::SecureToken
- Inherits:
-
Object
- Object
- Orthoses::ActiveRecord::SecureToken
- Defined in:
- lib/orthoses/active_record/secure_token.rb
Overview
def has_secure_token(attribute = :token, length: MINIMUM_TOKEN_LENGTH)
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(loader) ⇒ SecureToken
constructor
A new instance of SecureToken.
Constructor Details
#initialize(loader) ⇒ SecureToken
Returns a new instance of SecureToken.
7 8 9 |
# File 'lib/orthoses/active_record/secure_token.rb', line 7 def initialize(loader) @loader = loader end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/orthoses/active_record/secure_token.rb', line 11 def call has_secure_token = CallTracer::Lazy.new store = has_secure_token.trace('ActiveRecord::SecureToken::ClassMethods#has_secure_token') do @loader.call end has_secure_token.captures.each do |capture| base_name = Utils.module_name(capture.method.receiver) or next attribute = capture.argument[:attribute] store[base_name] << "def regenerate_#{attribute}: () -> bool" end store end |