egn 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/README.md +42 -2
- data/Rakefile +4 -0
- data/egn.gemspec +3 -2
- data/lib/egn/egn.rb +60 -0
- data/lib/egn/generator.rb +25 -22
- data/lib/egn/parser.rb +8 -25
- data/lib/egn/util.rb +41 -0
- data/lib/egn/validator.rb +8 -19
- data/lib/egn/version.rb +1 -1
- data/lib/egn.rb +10 -5
- data/spec/egn/egn_spec.rb +85 -0
- data/spec/egn/generator_spec.rb +88 -0
- data/spec/egn/parser_spec.rb +12 -0
- data/spec/egn/validator_spec.rb +29 -0
- data/spec/spec_helper.rb +17 -0
- metadata +41 -7
- data/LICENSE.txt +0 -22
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/gmitrev/egn.svg?branch=master)](https://travis-ci.org/gmitrev/egn)
|
2
|
+
[![Coverage Status](https://coveralls.io/repos/gmitrev/egn/badge.png?branch=master)](https://coveralls.io/r/gmitrev/egn?branch=master)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/gmitrev/egn.png)](https://codeclimate.com/github/gmitrev/egn)
|
1
4
|
# Egn
|
2
5
|
|
3
|
-
|
6
|
+
EGN(ЕГН) is the national identification number of Bulgarian citizens. This gem
|
7
|
+
provides ways to generate, validate and parse any given valid number for
|
8
|
+
information.
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -18,7 +23,42 @@ Or install it yourself as:
|
|
18
23
|
|
19
24
|
## Usage
|
20
25
|
|
21
|
-
|
26
|
+
require "egn"
|
27
|
+
|
28
|
+
# Quickly generate a random number
|
29
|
+
Egn.generate
|
30
|
+
# => "6101047500"
|
31
|
+
|
32
|
+
# Validate a given number
|
33
|
+
Egn.validate("6101047500")
|
34
|
+
# => true
|
35
|
+
|
36
|
+
# Create an new EGN object with a random number
|
37
|
+
egn = Egn::Egn.new
|
38
|
+
# => 9212094524
|
39
|
+
|
40
|
+
# OR generate EGN for a specific date
|
41
|
+
egn = Egn::Egn.new({year: 1945, month: 5, day: 8})
|
42
|
+
# => 4505085346
|
43
|
+
|
44
|
+
# OR parse an existing one
|
45
|
+
egn = Egn.parse("6101047500")
|
46
|
+
# => 6101047500
|
47
|
+
|
48
|
+
egn.birth_date
|
49
|
+
# => #<Date: 1961-01-04 ((2437304j,0s,0n),+0s,2299161j)>
|
50
|
+
|
51
|
+
egn.year
|
52
|
+
# => 1961
|
53
|
+
|
54
|
+
egn.month
|
55
|
+
# => 1
|
56
|
+
|
57
|
+
egn.day
|
58
|
+
# => 10
|
59
|
+
|
60
|
+
egn.valid?
|
61
|
+
# => true
|
22
62
|
|
23
63
|
## Contributing
|
24
64
|
|
data/Rakefile
CHANGED
data/egn.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Egn::VERSION
|
9
9
|
spec.authors = ["gmitrev"]
|
10
10
|
spec.email = ["gvmitrev@gmail.com"]
|
11
|
-
spec.description = %q{Generator, validator and info parser for EGN
|
12
|
-
spec.summary = %q{An easy way to generate and validate EGN
|
11
|
+
spec.description = %q{Generator, validator and info parser for EGN numbers}
|
12
|
+
spec.summary = %q{An easy way to generate and validate EGN numbers and parse them for useful information}
|
13
13
|
spec.homepage = "https://github.com/gmitrev/egn"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec", "~> 2.6"
|
24
|
+
spec.add_development_dependency "coveralls"
|
24
25
|
end
|
data/lib/egn/egn.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# The main data class
|
2
|
+
module Egn
|
3
|
+
class Egn
|
4
|
+
attr_reader :number, :birth_date
|
5
|
+
|
6
|
+
# Creates a new EGN object. Has different effects depending on the argument.
|
7
|
+
# When no arguments are given, it generates a new random EGN
|
8
|
+
# When a String is given, it is assumed that it is an EGN and is parsed
|
9
|
+
# When a hash is given, a new EGN is generated with the provided options
|
10
|
+
def initialize(args=nil)
|
11
|
+
|
12
|
+
if args.nil?
|
13
|
+
@number = Generator.generate
|
14
|
+
else
|
15
|
+
case args
|
16
|
+
when Hash
|
17
|
+
@number = Generator.generate(args)
|
18
|
+
when String
|
19
|
+
@number = args
|
20
|
+
raise ArgumentError, "Invalid EGN" unless self.valid?
|
21
|
+
else
|
22
|
+
raise ArgumentError, "Egn#new should be called either with an EGN or with an options hash"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
parse!
|
27
|
+
end
|
28
|
+
|
29
|
+
# Is the number valid?
|
30
|
+
def valid?
|
31
|
+
@valid ||= Validator.validate(@number)
|
32
|
+
end
|
33
|
+
|
34
|
+
def day
|
35
|
+
@birth_date.day
|
36
|
+
end
|
37
|
+
|
38
|
+
def month
|
39
|
+
@birth_date.month
|
40
|
+
end
|
41
|
+
|
42
|
+
def year
|
43
|
+
@birth_date.year
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
@number
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Extract the birth_date, sex and region
|
53
|
+
def parse!
|
54
|
+
info = Parser.new(@number)
|
55
|
+
|
56
|
+
@birth_date = info.date
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
data/lib/egn/generator.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
+
# Generates a random valid EGN
|
1
2
|
module Egn
|
2
3
|
module Generator
|
3
4
|
|
4
|
-
|
5
|
+
# The generated EGN will be completely random if no opitons are given.
|
6
|
+
# options is a hash that may have the following keys: :year, :month and :date
|
7
|
+
def self.generate(options={})
|
8
|
+
date = Util.time_rand
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
options = {
|
11
|
+
year: date.year,
|
12
|
+
month: date.month,
|
13
|
+
day: date.day
|
14
|
+
}.merge(options)
|
11
15
|
|
12
|
-
|
16
|
+
validate!(options)
|
17
|
+
|
18
|
+
century = options[:year] - (options[:year] % 100)
|
13
19
|
sex = Random.rand(1..2)
|
14
20
|
|
15
|
-
if
|
16
|
-
|
17
|
-
elsif
|
18
|
-
|
21
|
+
if century == 1800
|
22
|
+
options[:month] += 20
|
23
|
+
elsif century == 2000
|
24
|
+
options[:month] += 40
|
19
25
|
end
|
20
26
|
|
21
27
|
region = Random.rand(0..999)
|
@@ -26,21 +32,18 @@ module Egn
|
|
26
32
|
region += 1
|
27
33
|
end
|
28
34
|
|
29
|
-
final_year = year -
|
30
|
-
egn = final_year.to_s.rjust(2, '0') +
|
35
|
+
final_year = options[:year] - century
|
36
|
+
egn = final_year.to_s.rjust(2, '0') + options[:month].to_s.rjust(2, '0') + options[:day].to_s.rjust(2,'0') + region.to_s.rjust(3,'0')
|
31
37
|
|
32
|
-
return egn + egn_checksum(egn).to_s
|
38
|
+
return egn + Util.egn_checksum(egn).to_s
|
33
39
|
end
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
# Check if the options contain a date that is valid and be turned into an EGN
|
42
|
+
def self.validate!(options)
|
43
|
+
raise ArgumentError, "Year out of bounds" unless (1800..2099).include?(options[:year])
|
44
|
+
raise ArgumentError, "Month out of bounds" unless (1..12).include?(options[:month])
|
45
|
+
raise ArgumentError, "Day out of bounds" unless (1..31).include?(options[:day])
|
40
46
|
end
|
41
47
|
|
42
|
-
def self.time_rand(from = 0.0, to = Time.now)
|
43
|
-
Time.at(from + rand * (to.to_f - from.to_f))
|
44
|
-
end
|
45
48
|
end
|
46
49
|
end
|
data/lib/egn/parser.rb
CHANGED
@@ -1,34 +1,17 @@
|
|
1
1
|
module Egn
|
2
2
|
class Parser
|
3
|
+
attr_reader :date, :sex
|
3
4
|
|
5
|
+
# Parses the given EGN and returns all information that can be
|
6
|
+
# extracted from it: date, sex and region
|
4
7
|
def initialize(egn)
|
5
|
-
|
8
|
+
raise ArgumentError, "Invalid EGN" unless Validator.validate(egn)
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
case @month
|
12
|
-
when (1..12)
|
13
|
-
@year = "19#{@year}"
|
14
|
-
when (21..32)
|
15
|
-
@month -= 20
|
16
|
-
@year = "18#{@year}"
|
17
|
-
when (41..52)
|
18
|
-
@month -= 40
|
19
|
-
@year = "20#{@year}"
|
20
|
-
end
|
21
|
-
@year = @year.to_i
|
22
|
-
|
23
|
-
raise ArgumentError, "invalid date" unless Date.valid_date? @year, @month, @day
|
24
|
-
end
|
25
|
-
|
26
|
-
def birth_date
|
27
|
-
Date.parse("#{@year}-#{@month}-#{@day}")
|
28
|
-
end
|
29
|
-
|
30
|
-
def gender
|
10
|
+
# Extract the correct date
|
11
|
+
year, month, day = egn.scan(/.{1,2}/).map(&:to_i)
|
12
|
+
year, month = Util.determine_date(year, month)
|
31
13
|
|
14
|
+
@date = Date.new(year.to_i, month, day)
|
32
15
|
end
|
33
16
|
|
34
17
|
end
|
data/lib/egn/util.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Contains some utility methods that are used by the other classes
|
2
|
+
module Egn
|
3
|
+
module Util
|
4
|
+
WEIGHTS = [2,4,8,5,10,9,7,3,6]
|
5
|
+
|
6
|
+
# The EGN can have three different formats depending on the century. It can
|
7
|
+
# be determined by examining the month.
|
8
|
+
# The rules are as follows:
|
9
|
+
# * For people born in 1900..1999 the month does not change
|
10
|
+
# * For people born in 1800..1899 the month is +20 (e.g January is 21)
|
11
|
+
# * For people born in 2000..2099 the month is +40 (e.g December is 52)
|
12
|
+
def self.determine_date(year, month)
|
13
|
+
case month
|
14
|
+
when (1..12)
|
15
|
+
year = "19#{year}"
|
16
|
+
when (21..32)
|
17
|
+
month -= 20
|
18
|
+
year = "18#{year}"
|
19
|
+
when (41..52)
|
20
|
+
month -= 40
|
21
|
+
year = "20#{year}"
|
22
|
+
end
|
23
|
+
|
24
|
+
[year.to_i, month]
|
25
|
+
end
|
26
|
+
|
27
|
+
# The checksum is calculated from the first 9 digits.
|
28
|
+
def self.egn_checksum(egn)
|
29
|
+
sum = egn.split('').map(&:to_i).zip(WEIGHTS).map { |n| n.reduce(:*) }.reduce(:+)
|
30
|
+
|
31
|
+
rest = sum % 11
|
32
|
+
rest < 10 ? rest : 0
|
33
|
+
end
|
34
|
+
|
35
|
+
# Get a random date
|
36
|
+
def self.time_rand(from = 0.0, to = Time.now)
|
37
|
+
Time.at(from + rand * (to.to_f - from.to_f))
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/lib/egn/validator.rb
CHANGED
@@ -1,29 +1,18 @@
|
|
1
1
|
module Egn
|
2
|
-
|
2
|
+
class Validator
|
3
3
|
|
4
|
-
|
4
|
+
# Checks if a given EGN is valid
|
5
|
+
def self.validate(egn)
|
5
6
|
return false unless egn.length == 10
|
6
7
|
|
7
|
-
|
8
|
-
month =
|
9
|
-
|
10
|
-
|
11
|
-
case month
|
12
|
-
when (1..12)
|
13
|
-
year = "19#{year}"
|
14
|
-
when (21..32)
|
15
|
-
month -= 20
|
16
|
-
year = "18#{year}"
|
17
|
-
when (41..52)
|
18
|
-
month -= 40
|
19
|
-
year = "20#{year}"
|
20
|
-
end
|
21
|
-
year = year.to_i
|
8
|
+
# Extract the correct year and month
|
9
|
+
year, month, day = egn.scan(/.{1,2}/).map(&:to_i)
|
10
|
+
year, month = Util.determine_date(year, month)
|
22
11
|
|
23
12
|
return false unless Date.valid_date? year, month, day
|
24
13
|
|
25
|
-
checksum
|
26
|
-
|
14
|
+
# Calculate the checksum and check if the given one is correct
|
15
|
+
checksum = Util.egn_checksum egn[0,9]
|
27
16
|
checksum == egn[9].to_i
|
28
17
|
end
|
29
18
|
|
data/lib/egn/version.rb
CHANGED
data/lib/egn.rb
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
require "date"
|
2
2
|
|
3
|
-
require "egn/
|
3
|
+
require "egn/egn"
|
4
4
|
require "egn/parser"
|
5
5
|
require "egn/validator"
|
6
|
+
require "egn/generator"
|
6
7
|
require "egn/version"
|
8
|
+
require "egn/util"
|
7
9
|
|
8
10
|
module Egn
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
# Quick generate: returns a new number
|
13
|
+
def self.generate(options={})
|
14
|
+
Generator.generate(options)
|
12
15
|
end
|
13
16
|
|
17
|
+
# Quick validate
|
14
18
|
def self.validate(egn)
|
15
|
-
Validator.
|
19
|
+
Validator.validate(egn)
|
16
20
|
end
|
17
21
|
|
22
|
+
# Quick parse
|
18
23
|
def self.parse(egn)
|
19
|
-
|
24
|
+
Egn.new(egn)
|
20
25
|
end
|
21
26
|
|
22
27
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Egn" do
|
4
|
+
|
5
|
+
describe '.initialize' do
|
6
|
+
|
7
|
+
context "invoked with no args" do
|
8
|
+
|
9
|
+
it 'generates a valid number' do
|
10
|
+
egn = Egn::Egn.new
|
11
|
+
|
12
|
+
expect(egn).to be_valid
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns different number every time' do
|
16
|
+
egn1 = Egn::Egn.new
|
17
|
+
egn2 = Egn::Egn.new
|
18
|
+
|
19
|
+
expect(egn1.number).not_to eq egn2.number
|
20
|
+
end
|
21
|
+
|
22
|
+
it "delegates the creation to Generators::Egn" do
|
23
|
+
|
24
|
+
Egn::Generator.should_receive(:generate).and_return "6101047500"
|
25
|
+
|
26
|
+
Egn::Egn.new
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "invoked with an EGN " do
|
32
|
+
|
33
|
+
it "returns a new Egn object if the provided EGN is valid" do
|
34
|
+
egn = Egn::Egn.new('6101047500')
|
35
|
+
|
36
|
+
expect(egn).to be_valid
|
37
|
+
end
|
38
|
+
|
39
|
+
it "raises an ArgumentError if the provided EGN is not valid" do
|
40
|
+
expect{
|
41
|
+
Egn::Egn.new("I'm invalid")
|
42
|
+
}.to raise_error ArgumentError
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
context "invoked with an options hash" do
|
48
|
+
|
49
|
+
it "passes the options to the #generate method" do
|
50
|
+
options = {
|
51
|
+
year: 1960,
|
52
|
+
month: 12
|
53
|
+
}
|
54
|
+
|
55
|
+
Egn::Generator.should_receive(:generate).with(options).and_return('6012081988')
|
56
|
+
|
57
|
+
Egn::Egn.new(options)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
context "invoked with something else" do
|
63
|
+
it 'raises an ArgumentError' do
|
64
|
+
expect{
|
65
|
+
Egn::Egn.new([1,2,'hi'])
|
66
|
+
}.to raise_error ArgumentError
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "valid?" do
|
72
|
+
it 'delegates the validation to Validators::Egn' do
|
73
|
+
egn = Egn::Egn.new
|
74
|
+
Egn::Validator.should_receive(:validate).with(egn.number)
|
75
|
+
egn.valid?
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
describe 'validating'
|
81
|
+
|
82
|
+
describe 'parsing'
|
83
|
+
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Egn::Generator do
|
4
|
+
|
5
|
+
describe "#generate" do
|
6
|
+
context "invoked with no arguments" do
|
7
|
+
|
8
|
+
it 'generates a valid number' do
|
9
|
+
egn = Egn::Generator.generate
|
10
|
+
|
11
|
+
expect(egn).not_to be_empty
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns different number every time' do
|
15
|
+
egn1 = Egn::Generator.generate
|
16
|
+
egn2 = Egn::Generator.generate
|
17
|
+
|
18
|
+
expect(egn1).not_to eq egn2
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
context "invoked with arguments" do
|
24
|
+
it "generates a new EGN considering the given options" do
|
25
|
+
number = Egn::Generator.generate(year: 1990, month: 12, day: 30, sex: :m)
|
26
|
+
egn = Egn::Egn.new(number)
|
27
|
+
|
28
|
+
expect(egn).to be_valid
|
29
|
+
end
|
30
|
+
|
31
|
+
it "generates a new EGN with the given year" do
|
32
|
+
number = Egn::Generator.generate(year: 1990)
|
33
|
+
egn = Egn::Egn.new(number)
|
34
|
+
|
35
|
+
expect(egn.year).to eq(1990)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "generates a new EGN with the given month" do
|
39
|
+
number = Egn::Generator.generate(month: 6)
|
40
|
+
egn = Egn::Egn.new(number)
|
41
|
+
|
42
|
+
expect(egn.month).to eq(6)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "generates a new EGN with the given day" do
|
46
|
+
number = Egn::Generator.generate(day: 15)
|
47
|
+
egn = Egn::Egn.new(number)
|
48
|
+
|
49
|
+
expect(egn.day).to eq(15)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "validates the options" do
|
53
|
+
|
54
|
+
options = {year: 1960, month: 6, day: 3}
|
55
|
+
|
56
|
+
Egn::Generator.should_receive(:validate!).with(options)
|
57
|
+
|
58
|
+
Egn::Generator.generate(options)
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#validate!" do
|
66
|
+
|
67
|
+
it "raises an exception if invalid year is given" do
|
68
|
+
expect{
|
69
|
+
Egn::Generator.generate(year: 1500)
|
70
|
+
}.to raise_error ArgumentError
|
71
|
+
end
|
72
|
+
|
73
|
+
it "raises an exception if invalid month is given" do
|
74
|
+
expect{
|
75
|
+
Egn::Generator.generate(month: 15)
|
76
|
+
}.to raise_error ArgumentError
|
77
|
+
end
|
78
|
+
|
79
|
+
it "raises an exception if invalid day is given" do
|
80
|
+
expect{
|
81
|
+
Egn::Generator.generate(day: 33)
|
82
|
+
}.to raise_error ArgumentError
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Egn::Validator do
|
4
|
+
|
5
|
+
describe "#validate" do
|
6
|
+
|
7
|
+
it "fails for strings with incorrect size" do
|
8
|
+
expect(Egn::Validator.validate("123456789")).to be_false
|
9
|
+
expect(Egn::Validator.validate("12345678901")).to be_false
|
10
|
+
end
|
11
|
+
|
12
|
+
it "fails for incorrect dates" do
|
13
|
+
|
14
|
+
expect(Egn::Validator.validate("6101347500")).to be_false
|
15
|
+
end
|
16
|
+
|
17
|
+
it "checks 500 000 of the generated numbers", :brute do
|
18
|
+
egns = Array.new(500_000).map{ |i| Egn.generate }
|
19
|
+
egns.each do |egn|
|
20
|
+
result = Egn::Validator.validate(egn)
|
21
|
+
puts egn unless result
|
22
|
+
expect(result).to be_true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'egn'
|
5
|
+
|
6
|
+
require 'coveralls'
|
7
|
+
Coveralls.wear!
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run :focus
|
13
|
+
config.filter_run_excluding :brute
|
14
|
+
|
15
|
+
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,7 +59,23 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.6'
|
62
|
-
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: coveralls
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Generator, validator and info parser for EGN numbers
|
63
79
|
email:
|
64
80
|
- gvmitrev@gmail.com
|
65
81
|
executables: []
|
@@ -67,17 +83,25 @@ extensions: []
|
|
67
83
|
extra_rdoc_files: []
|
68
84
|
files:
|
69
85
|
- .gitignore
|
86
|
+
- .rspec
|
87
|
+
- .travis.yml
|
70
88
|
- Gemfile
|
71
89
|
- LICENSE
|
72
|
-
- LICENSE.txt
|
73
90
|
- README.md
|
74
91
|
- Rakefile
|
75
92
|
- egn.gemspec
|
76
93
|
- lib/egn.rb
|
94
|
+
- lib/egn/egn.rb
|
77
95
|
- lib/egn/generator.rb
|
78
96
|
- lib/egn/parser.rb
|
97
|
+
- lib/egn/util.rb
|
79
98
|
- lib/egn/validator.rb
|
80
99
|
- lib/egn/version.rb
|
100
|
+
- spec/egn/egn_spec.rb
|
101
|
+
- spec/egn/generator_spec.rb
|
102
|
+
- spec/egn/parser_spec.rb
|
103
|
+
- spec/egn/validator_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
81
105
|
homepage: https://github.com/gmitrev/egn
|
82
106
|
licenses:
|
83
107
|
- MIT
|
@@ -91,18 +115,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
115
|
- - ! '>='
|
92
116
|
- !ruby/object:Gem::Version
|
93
117
|
version: '0'
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
hash: 152494033
|
94
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
122
|
none: false
|
96
123
|
requirements:
|
97
124
|
- - ! '>='
|
98
125
|
- !ruby/object:Gem::Version
|
99
126
|
version: '0'
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
hash: 152494033
|
100
130
|
requirements: []
|
101
131
|
rubyforge_project:
|
102
132
|
rubygems_version: 1.8.23
|
103
133
|
signing_key:
|
104
134
|
specification_version: 3
|
105
|
-
summary: An easy way to generate and validate EGN
|
135
|
+
summary: An easy way to generate and validate EGN numbers and parse them for useful
|
106
136
|
information
|
107
|
-
test_files:
|
108
|
-
|
137
|
+
test_files:
|
138
|
+
- spec/egn/egn_spec.rb
|
139
|
+
- spec/egn/generator_spec.rb
|
140
|
+
- spec/egn/parser_spec.rb
|
141
|
+
- spec/egn/validator_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 gmitrev
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|