Module: SecID::Checkable::ClassMethods
- Defined in:
- lib/sec_id/concerns/checkable.rb
Overview
Class methods added when Checkable is included.
Instance Method Summary collapse
-
#check_digit(id) ⇒ Integer, String
deprecated
Deprecated.
Use #checksum. Kept as a v7 bridge; removed in v8.
-
#checksum(id) ⇒ Integer, String
The calculated checksum.
-
#restore(id_without_checksum) ⇒ String
Returns the full identifier string with correct checksum.
-
#restore!(id_without_checksum) ⇒ self
Restores (calculates) the checksum and returns the instance.
Instance Method Details
#check_digit(id) ⇒ Integer, String
Deprecated.
Use #checksum. Kept as a v7 bridge; removed in v8.
Returns the calculated checksum.
101 102 103 104 |
# File 'lib/sec_id/concerns/checkable.rb', line 101 def check_digit(id) SecID::Deprecation.warn(old: 'check_digit', new: 'checksum') checksum(id) end |
#checksum(id) ⇒ Integer, String
Returns the calculated checksum.
92 93 94 |
# File 'lib/sec_id/concerns/checkable.rb', line 92 def checksum(id) new(id).calculate_checksum end |
#restore(id_without_checksum) ⇒ String
Returns the full identifier string with correct checksum.
76 77 78 |
# File 'lib/sec_id/concerns/checkable.rb', line 76 def restore(id_without_checksum) new(id_without_checksum).restore end |
#restore!(id_without_checksum) ⇒ self
Restores (calculates) the checksum and returns the instance.
85 86 87 |
# File 'lib/sec_id/concerns/checkable.rb', line 85 def restore!(id_without_checksum) new(id_without_checksum).restore! end |