swedish-pin 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.solargraph.yml +16 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +2 -2
- data/Rakefile +0 -2
- data/lib/swedish_pin/personnummer.rb +23 -0
- data/lib/swedish_pin/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c73538c495e9979b1e6c9e0522cf0f31e256b7b702b7d3ef90ac129652cd69f
|
4
|
+
data.tar.gz: 21425a9f86ea45183ae7f980f9123f90bc057e211f2fbb6c2fff827e1069b194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a480ae496c3dfada7d9c87527ea2a0b3d8cf5d1f1149971ac41a8efb563ba01bb4b8db52f438014d37f4fa523ca743eef72d275accac161d423d50f409f156
|
7
|
+
data.tar.gz: d4183b7a8c578c4e18aa11b7617044f01789d67d1e85ce8d2449385246a443ebbb40f4e8e7905b347b31f1f8922d40208b6f511a2cc818d584aa15fe50d7f1db
|
data/.solargraph.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -7,9 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [1.1.0] - 2022-07-04
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
* `rake test` actually runs tests now.
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
* `Personnummer` can now be compared and sorted.
|
19
|
+
* `Personnummer` works as hash keys by value.
|
20
|
+
|
10
21
|
## [1.0.0] - 2020-09-09
|
11
22
|
|
12
23
|
Initial release.
|
13
24
|
|
14
25
|
[Unreleased]: https://github.com/Mange/swedish-pin-ruby/compare/v1.0.0...HEAD
|
15
26
|
[1.0.0]: https://github.com/Mange/swedish-pin-ruby/releases/tag/v1.0.0
|
27
|
+
[1.1.0]: https://github.com/Mange/swedish-pin-ruby/releases/tag/v1.1.0
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -8,6 +8,8 @@ module SwedishPIN
|
|
8
8
|
#
|
9
9
|
# @see https://en.wikipedia.org/wiki/Personal_identity_number_(Sweden) Personnummer on Wikipedia.
|
10
10
|
class Personnummer
|
11
|
+
include Comparable
|
12
|
+
|
11
13
|
attr_reader :year, :month, :day, :sequence_number, :control_digit
|
12
14
|
# @!attribute [r] year
|
13
15
|
# The full year of the _personnummer_. For example +1989+.
|
@@ -175,6 +177,27 @@ module SwedishPIN
|
|
175
177
|
sequence_number.even?
|
176
178
|
end
|
177
179
|
|
180
|
+
def ==(other)
|
181
|
+
if other.is_a?(self.class)
|
182
|
+
format_long == other.format_long
|
183
|
+
else
|
184
|
+
super
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def <=>(other)
|
189
|
+
if other.is_a?(self.class)
|
190
|
+
format_long <=> other.format_long
|
191
|
+
else
|
192
|
+
super
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def hash
|
197
|
+
[self.class, format_long].hash
|
198
|
+
end
|
199
|
+
alias_method :eql?, :==
|
200
|
+
|
178
201
|
private
|
179
202
|
|
180
203
|
def short_separator(now)
|
data/lib/swedish_pin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swedish-pin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Bergmark
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -65,6 +65,7 @@ extensions: []
|
|
65
65
|
extra_rdoc_files: []
|
66
66
|
files:
|
67
67
|
- ".gitignore"
|
68
|
+
- ".solargraph.yml"
|
68
69
|
- ".travis.yml"
|
69
70
|
- CHANGELOG.md
|
70
71
|
- Gemfile
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.2.22
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Work with Swedish PINs (Personnummer)
|