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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb6a746d0ef33cae631f59b11006ee17a98cc38af65b69b35a0f025a22beeae1
4
- data.tar.gz: c9e0ca8008e77aab92808afee2e619bf6a7ed8d9461319449a304128a50237d5
3
+ metadata.gz: 2c73538c495e9979b1e6c9e0522cf0f31e256b7b702b7d3ef90ac129652cd69f
4
+ data.tar.gz: 21425a9f86ea45183ae7f980f9123f90bc057e211f2fbb6c2fff827e1069b194
5
5
  SHA512:
6
- metadata.gz: cd9f5e5328d76e4d709a4d0b8e688b3e13fd186fb57c66eb82a8793215e01231cb1799d41a4e16a75b306d1d37c9cb3d7a2c1cb98a0ae79dec18ea5bc9cf554e
7
- data.tar.gz: 4b7ed29721a100dc98515d181748f47d0c3957d677a19fb93a6ee287837a270dd845ccdaf20ec504735d7e20ad4d03629dc48cdb052d112380fafb3315ced81a
6
+ metadata.gz: 85a480ae496c3dfada7d9c87527ea2a0b3d8cf5d1f1149971ac41a8efb563ba01bb4b8db52f438014d37f4fa523ca743eef72d275accac161d423d50f409f156
7
+ data.tar.gz: d4183b7a8c578c4e18aa11b7617044f01789d67d1e85ce8d2449385246a443ebbb40f4e8e7905b347b31f1f8922d40208b6f511a2cc818d584aa15fe50d7f1db
data/.solargraph.yml ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ plugins:
12
+ - solargraph-standardrb
13
+ reporters:
14
+ - standardrb
15
+ require_paths: []
16
+ max_files: 5000
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swedish-pin (1.0.0)
4
+ swedish-pin (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -44,4 +44,4 @@ DEPENDENCIES
44
44
  swedish-pin!
45
45
 
46
46
  BUNDLED WITH
47
- 2.1.4
47
+ 2.2.22
data/Rakefile CHANGED
@@ -3,8 +3,6 @@ require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
5
  t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
6
  end
9
7
 
10
8
  task default: :test
@@ -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)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SwedishPIN
4
4
  # The version number of this library.
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
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.0.0
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: 2020-09-09 00:00:00.000000000 Z
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.0.8
103
+ rubygems_version: 3.2.22
103
104
  signing_key:
104
105
  specification_version: 4
105
106
  summary: Work with Swedish PINs (Personnummer)