luhn_checksum
Implementation of the Luhn algorithm for detecting credit card numbers in a stream of input text.
Example:
LuhnChecksum.valid?('123451234512348')
Limitations
-
LuhnChecksum.valid?
currently assumes that input text has already been validated to consist of only digits. An exception will be thrown if non-digits are passed in. -
LuhnChecksum.valid?
does not validate that the number passed in is any particular length. The number6789
will be considered valid, even though most credit card numbers are between 13 and 19 digits in length.
Releasing a new version
A new version is published to RubyGems.org every time a change to version.rb
is pushed to the main
branch.
In short, follow these steps:
- Update
version.rb
, - run
bundle lock
to updateGemfile.lock
, - merge this change into
main
, and - look at the action for output.
To create a pre-release from a non-main branch:
- change the version in
version.rb
to something like1.2.0.pre.1
or2.0.0.beta.2
, - push this change to your branch,
- go to Actions → “Publish to RubyGems.org” on GitHub,
- click the “Run workflow” button,
- pick your branch from a dropdown.
License
Apache License 2.0