Module: HasTokenId::Concern::InstanceMethods

Defined in:
lib/has_token_id/concern.rb

Overview

ClassMethods

Instance Method Summary collapse

Instance Method Details

#short_tokenObject

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.has_token_id_options[:length]
  len = self.class.has_token_id_options[:short_token_length]
  to_param[0, len < max ? len : max]
end

#to_paramObject

Returns the resource’s token



41
42
43
# File 'lib/has_token_id/concern.rb', line 41

def to_param
  self.send(self.class.has_token_id_options[:param_name])
end