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.
97 98 99 100 |
# File 'lib/sec_id/concerns/checkable.rb', line 97 def check_digit(id) SecID::Deprecation.warn(old: 'check_digit', new: 'checksum') checksum(id) end |
#checksum(id) ⇒ Integer, String
Returns the calculated checksum.
88 89 90 |
# File 'lib/sec_id/concerns/checkable.rb', line 88 def checksum(id) new(id).calculate_checksum end |
#restore(id_without_checksum) ⇒ String
Returns the full identifier string with correct checksum.
72 73 74 |
# File 'lib/sec_id/concerns/checkable.rb', line 72 def restore(id_without_checksum) new(id_without_checksum).restore end |
#restore!(id_without_checksum) ⇒ self
Restores (calculates) the checksum and returns the instance.
81 82 83 |
# File 'lib/sec_id/concerns/checkable.rb', line 81 def restore!(id_without_checksum) new(id_without_checksum).restore! end |