moeffju-luhn 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -3
- data/Rakefile +5 -0
- data/lib/luhn.rb +1 -1
- data/lib/luhn/version.rb +1 -1
- data/luhn.gemspec +3 -0
- data/spec/luhn_spec.rb +4 -4
- metadata +34 -2
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Adds methods to Fixnum and String to generate and validate Luhn checksums.
|
4
4
|
|
5
|
+
[](http://travis-ci.org/moeffju/luhn)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -20,7 +22,7 @@ The gem's name is 'luhn', so you need to `require luhn`.
|
|
20
22
|
|
21
23
|
## Usage
|
22
24
|
|
23
|
-
`Fixnum
|
25
|
+
`Numeric` (`Fixnum`, `Bignum`):
|
24
26
|
|
25
27
|
```
|
26
28
|
4100410382.luhn? #=> true
|
@@ -45,5 +47,6 @@ And for `String`s:
|
|
45
47
|
1. Fork it
|
46
48
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
49
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
48
|
-
4.
|
49
|
-
5.
|
50
|
+
4. Make sure the specs pass / extend the specs
|
51
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
52
|
+
6. Create new Pull Request
|
data/Rakefile
CHANGED
data/lib/luhn.rb
CHANGED
data/lib/luhn/version.rb
CHANGED
data/luhn.gemspec
CHANGED
data/spec/luhn_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative './spec_helper'
|
2
2
|
|
3
3
|
describe "Luhn" do
|
4
|
-
describe "on
|
4
|
+
describe "on Numeric" do
|
5
5
|
let(:valid) { 4100410382 }
|
6
6
|
let(:valid_check) { 2 }
|
7
7
|
let(:incomplete) { 410041038 }
|
@@ -23,12 +23,12 @@ describe "Luhn" do
|
|
23
23
|
incomplete.luhn!.should == valid
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should
|
27
|
-
incomplete.luhn!.should be_a
|
26
|
+
it "should quack like a Numeric" do
|
27
|
+
incomplete.luhn!.should be_a Numeric
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "on
|
31
|
+
describe "on String" do
|
32
32
|
let(:valid) { '4 10041038 2' }
|
33
33
|
let(:valid_check) { '2' }
|
34
34
|
let(:incomplete) { '410041038' }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moeffju-luhn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,39 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-08-16 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
14
46
|
description: ! 'Adds methods to Fixnum and String to generate and validate Luhn check
|
15
47
|
digits, e.g. for credit card numbers, civic numbers, some account numbers etc. More
|
16
48
|
info: https://en.wikipedia.org/wiki/Luhn_algorithm'
|