iceland 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.
- checksums.yaml +4 -4
- data/lib/iceland/version.rb +1 -1
- data/lib/iceland.rb +4 -4
- 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: ef1b9601286ec63ae41cbfad801d93ff3c0e7b91
|
4
|
+
data.tar.gz: aaa43941a8b95be9e661d8e804b3d5dcbbb72c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf7ae37611866995e018ec7d179819c107d039aecb31485c82b5e653de94698a1aff5b246c71b1ddf75fd8462090147e9ce1db8fce44a8e2dd379f13b70a3943
|
7
|
+
data.tar.gz: 21de710a07509af70d0766ef80588598daf4a8e8f1028db5cb6c3577959f6d99b0da56a3f8a2d9d04040b2955a90e7f8b2141a3f366be2e01c1b89ecf7404a41
|
data/lib/iceland/version.rb
CHANGED
data/lib/iceland.rb
CHANGED
@@ -47,7 +47,7 @@ end
|
|
47
47
|
# The Kennitala Class
|
48
48
|
class Kennitala
|
49
49
|
def initialize(kt_string)
|
50
|
-
unless kt_string.
|
50
|
+
unless kt_string.class == String
|
51
51
|
raise ArgumentError, 'Kennitala needs to be provided as a string'
|
52
52
|
end
|
53
53
|
sanitised_kt = sanitize(kt_string)
|
@@ -57,11 +57,11 @@ class Kennitala
|
|
57
57
|
|
58
58
|
# Get the type of entity - If it is a person or an organization
|
59
59
|
#
|
60
|
-
# @return [String] Either 'person' or '
|
60
|
+
# @return [String] Either 'person' or 'company'
|
61
61
|
def entity_type
|
62
62
|
date_integer = @value[0, 2].to_i
|
63
63
|
return 'person' if date_integer < 32
|
64
|
-
return '
|
64
|
+
return 'company' if (date_integer > 40) && (date_integer < 71)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Get the year of birth or registration
|
@@ -71,7 +71,7 @@ class Kennitala
|
|
71
71
|
century = (10 + @value[9].to_i) * 100
|
72
72
|
year = @value[4, 2].to_i
|
73
73
|
return century + year if (1800..1900).cover?(century)
|
74
|
-
return 2000 + year if century ==
|
74
|
+
return 2000 + year if century == 1000
|
75
75
|
end
|
76
76
|
|
77
77
|
# Get the day of the month of birth or registration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iceland
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vignir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|