turkish_id 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/bin/turkish_id +25 -7
- data/lib/turkish_id/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d96231198d925643a7631ec1d6c349b2a0e9ecb0
|
4
|
+
data.tar.gz: 486a165f4ec17935636c3533e5271a3282d75dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bef5b54e4efac51b1812196c4d60fc5a6d963223453022c598622921cfcddff79310725ed8b8fe18647a39a407aa693a34e8f13b8e49dccadde5853a3783eedb
|
7
|
+
data.tar.gz: 491c4e22eac5b642f3a7cc52088814cae870d8c3dec666993000d57e6734518ab54a56422252624bf7f8b3af94891a53eb6fb20ddf0fe09ca43e04902aa594fc
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This gem provides methods to validate Turkish Identification Numbers.
|
|
7
7
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
|
-
```
|
10
|
+
```rb
|
11
11
|
gem 'turkish_id'
|
12
12
|
```
|
13
13
|
|
@@ -22,9 +22,11 @@ Or install it yourself as:
|
|
22
22
|
## Usage
|
23
23
|
|
24
24
|
Create a new instance:
|
25
|
+
|
25
26
|
```rb
|
26
27
|
identity_number = TurkishId.new('10000000146')
|
27
28
|
```
|
29
|
+
|
28
30
|
Use ```is_valid?``` method to check validity:
|
29
31
|
|
30
32
|
```rb
|
@@ -32,6 +34,13 @@ identity_number.is_valid?
|
|
32
34
|
=> true
|
33
35
|
```
|
34
36
|
|
37
|
+
Or use the command line executable:
|
38
|
+
|
39
|
+
```sh
|
40
|
+
$ turkish_id 10000000078
|
41
|
+
Your identification number is valid.
|
42
|
+
```
|
43
|
+
|
35
44
|
## Anatomy of the Turkish ID Number
|
36
45
|
|
37
46
|
The Turkish Identification Number consists of ```11``` digits.
|
data/bin/turkish_id
CHANGED
@@ -6,13 +6,31 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
|
6
6
|
|
7
7
|
require 'turkish_id'
|
8
8
|
|
9
|
-
|
9
|
+
@help = '
|
10
|
+
Usage
|
11
|
+
turkish_id QUERY
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Examples
|
14
|
+
turkish_id 10000000078
|
15
|
+
turkish_id 10000000146
|
16
|
+
|
17
|
+
'
|
18
|
+
|
19
|
+
def parse_input
|
20
|
+
ARGV[0] ? validate_id(ARGV[0]) : print_help
|
21
|
+
end
|
22
|
+
|
23
|
+
def validate_id(id_number)
|
24
|
+
identity_number = TurkishId.new(id_number)
|
25
|
+
print_result(identity_number.is_valid?)
|
26
|
+
end
|
27
|
+
|
28
|
+
def print_result(result)
|
29
|
+
STDOUT.puts "Your identification number is #{ result ? 'valid' : 'invalid' }."
|
30
|
+
end
|
31
|
+
|
32
|
+
def print_help
|
33
|
+
STDOUT.puts @help
|
16
34
|
end
|
17
35
|
|
18
|
-
|
36
|
+
parse_input
|
data/lib/turkish_id/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kerem Bozdas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|