Sha256: c08c5576b006745625156c62f69b32be7aa1a4ebbb6c29a029912d2a1cd0e1fc

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# Luhn

Adds methods to Fixnum and String to generate and validate Luhn checksums.

[![Build Status](https://secure.travis-ci.org/moeffju/luhn.png?branch=master)](http://travis-ci.org/moeffju/luhn)

## Installation

Add this line to your application's Gemfile:

    gem 'moeffju-luhn', :require => 'luhn'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install moeffju-luhn

The gem's name is 'luhn', so you need to `require luhn`.

## Usage

`Numeric` (`Fixnum`, `Bignum`):

```
4100410382.luhn?  #=> true
410041038.luhn    #=> 2
410041038.luhn!   #=> 4100410382

4100410648.luhn?  #=> true
410041064.luhn    #=> 8
410041064.luhn!   #=> 4100410648
```

And for `String`s:

```
'4 10041064 8'.luhn?  #=> true
'4 10041064'.luhn     #=> "8"
'4 10041064'.luhn!    #=> "4100410648"
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Make sure the specs pass / extend the specs
5. Push to the branch (`git push origin my-new-feature`)
6. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moeffju-luhn-0.1.2 README.md