Module: HasTokenId::Concern::InstanceMethods
- Defined in:
- lib/has_token_id/concern.rb
Overview
ClassMethods
Instance Method Summary collapse
-
#short_token ⇒ Object
Returns the first N digits of the resource’s token N = has_token_id_options.
-
#to_param ⇒ Object
Returns the resource’s token.
Instance Method Details
#short_token ⇒ Object
Returns the first N digits of the resource’s token N = has_token_id_options
47 48 49 50 51 |
# File 'lib/has_token_id/concern.rb', line 47 def short_token max = self.class.[:length] len = self.class.[:short_token_length] to_param[0, len < max ? len : max] end |
#to_param ⇒ Object
Returns the resource’s token
41 42 43 |
# File 'lib/has_token_id/concern.rb', line 41 def to_param self.send(self.class.[:param_name]) end |