elo_rankable 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86bcf51f66c5277158515c682315939854420e425ab2420444cfe741cb5983dd
4
- data.tar.gz: 07fcf63227ace8f85b1252a516c1ddc78a5f7d9da898a14853d0101332f12ace
3
+ metadata.gz: 5301ca9d389672548e302fc188a284b615dfe051d6eb567a4414616fe9b3844e
4
+ data.tar.gz: 5e95c93f2f631c50650b3a5795f6a27a848df764f5a06f8c337760b093291d5d
5
5
  SHA512:
6
- metadata.gz: 8640709b92cfc951035ecfb9f7f5db0ffea2c4ac82555690011180f95d1e1dde1853dad35b441bff0daae01aee4793ee2d42a49c37041e108934461368e3a082
7
- data.tar.gz: a5aaad2d630914ae6b509d579b61b6736b722c5f9c4a421e66674e79ee6d2414e3ab783cb610bf714bd3316aed9cb520715caf6ceb2db4e0d5badb062e949beb
6
+ metadata.gz: 778ea1d6d4826cb295267ae7974c453b40eaeb512581ba9c1863e1cf8a2d3ca2734627ee73c364eb6c7571cfeb774d7af5f97a54d93b2bbfd0916ac2e6a6c9e3
7
+ data.tar.gz: 269c6ab72293e2d61eb44c679acd666af9c4239a3f389c656f0aef32442e9e90abf2d639910a53ed1f5b28d203bdadf1a6cc81ee763657667637bf75283bc880
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,38 +1,38 @@
1
- AllCops:
2
- NewCops: enable
3
- SuggestExtensions: false
4
- TargetRubyVersion: 2.7
5
-
6
- # Disable some overly strict metrics for gem development
7
- Metrics/AbcSize:
8
- Max: 30
9
-
10
- Metrics/MethodLength:
11
- Max: 15
12
-
13
- Metrics/CyclomaticComplexity:
14
- Max: 10
15
-
16
- Metrics/PerceivedComplexity:
17
- Max: 10
18
-
19
- Layout/LineLength:
20
- Max: 250
21
-
22
- Metrics/BlockLength:
23
- Exclude:
24
- - 'spec/**/*'
25
- - '*.gemspec'
26
-
27
- # Allow longer variable names with numbers for test clarity
28
- Naming/VariableNumber:
29
- EnforcedStyle: normalcase
30
-
31
- # Allow predicate method names like has_elo_ranking for ActiveRecord-style methods
32
- Naming/PredicatePrefix:
33
- AllowedMethods:
34
- - has_elo_ranking
35
-
36
- # Documentation is not always necessary for internal classes
37
- Style/Documentation:
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 2.7
5
+
6
+ # Disable some overly strict metrics for gem development
7
+ Metrics/AbcSize:
8
+ Max: 30
9
+
10
+ Metrics/MethodLength:
11
+ Max: 15
12
+
13
+ Metrics/CyclomaticComplexity:
14
+ Max: 10
15
+
16
+ Metrics/PerceivedComplexity:
17
+ Max: 10
18
+
19
+ Layout/LineLength:
20
+ Max: 250
21
+
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - 'spec/**/*'
25
+ - '*.gemspec'
26
+
27
+ # Allow longer variable names with numbers for test clarity
28
+ Naming/VariableNumber:
29
+ EnforcedStyle: normalcase
30
+
31
+ # Allow predicate method names like has_elo_ranking for ActiveRecord-style methods
32
+ Naming/PredicatePrefix:
33
+ AllowedMethods:
34
+ - has_elo_ranking
35
+
36
+ # Documentation is not always necessary for internal classes
37
+ Style/Documentation:
38
38
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,63 +1,67 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.2.0] - 2025-08-09
9
-
10
- - Initial Gem release.
11
-
12
- ## [0.1.2] - 2025-08-08
13
-
14
- ### Added
15
- - Comprehensive input validation for all public methods
16
- - Early validation in `record_multiplayer_match` and `record_winner_vs_all` methods
17
- - Validation for `record_draw` method
18
- - Defensive validation in Calculator methods
19
- - Detection of duplicate players in multiplayer matches
20
- - Validation for nil values in player arrays
21
- - Validation for non-rankable objects
22
- - Validation for destroyed/deleted players
23
-
24
- ### Fixed
25
- - **BREAKING**: Improved error handling with descriptive ArgumentError exceptions instead of NoMethodError or database constraint violations
26
- - Fixed validation gaps where errors would bubble up from Calculator instead of being caught early
27
- - Fixed race conditions in validation logic by caching `elo_ranking` calls
28
- - Improved validation in `validate_opponent!` method to properly handle destroyed records
29
-
30
- ### Changed
31
- - **BREAKING**: `record_multiplayer_match` now raises `ArgumentError` for duplicate players instead of allowing self-matches
32
- - **BREAKING**: `record_winner_vs_all` now validates winner and losers arrays upfront
33
- - **BREAKING**: `record_draw` now validates both players upfront
34
- - All validation errors now provide clear, descriptive error messages
35
-
36
- ## [0.1.1] - 2025-08-07
37
-
38
- ### Fixed
39
- - Added proper input validation to `beat!`, `lost_to!`, and `draw_with!` methods
40
- - Fixed SQLite3 gem version compatibility with ActiveRecord 8.0
41
-
42
- ### Added
43
- - Comprehensive edge case testing for high ratings, negative ratings, and invalid inputs
44
- - Performance tests for leaderboard queries and association loading
45
- - Input validation with descriptive error messages for nil players and self-matches
46
-
47
- ### Changed
48
- - Improved error handling with ArgumentError exceptions for invalid match scenarios
49
- - Enhanced test suite with better coverage of edge cases and error conditions
50
-
51
- ## [0.1.0] - 2025-08-06
52
-
53
- ### Added
54
- - Initial release
55
- - `has_elo_ranking` macro for ActiveRecord models
56
- - Support for 1v1 matches with `beat!`, `lost_to!`, and `draw_with!` methods
57
- - Multiplayer ranked match support via `EloRankable.record_multiplayer_match`
58
- - Winner-vs-all match support via `EloRankable.record_winner_vs_all`
59
- - Configurable base rating and K-factor strategies
60
- - Leaderboard scopes (`by_elo_rating`, `top_rated`)
61
- - Polymorphic EloRanking model for clean separation
62
- - Rails generator for database migration
63
- - Comprehensive test suite
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.1] - 2025-08-09
9
+
10
+ - Changed dependency versions to ensure compatibility with Rails 8.1 and ActiveRecord 8.1
11
+
12
+ ## [0.2.0] - 2025-08-09
13
+
14
+ - Initial Gem release.
15
+
16
+ ## [0.1.2] - 2025-08-08
17
+
18
+ ### Added
19
+ - Comprehensive input validation for all public methods
20
+ - Early validation in `record_multiplayer_match` and `record_winner_vs_all` methods
21
+ - Validation for `record_draw` method
22
+ - Defensive validation in Calculator methods
23
+ - Detection of duplicate players in multiplayer matches
24
+ - Validation for nil values in player arrays
25
+ - Validation for non-rankable objects
26
+ - Validation for destroyed/deleted players
27
+
28
+ ### Fixed
29
+ - **BREAKING**: Improved error handling with descriptive ArgumentError exceptions instead of NoMethodError or database constraint violations
30
+ - Fixed validation gaps where errors would bubble up from Calculator instead of being caught early
31
+ - Fixed race conditions in validation logic by caching `elo_ranking` calls
32
+ - Improved validation in `validate_opponent!` method to properly handle destroyed records
33
+
34
+ ### Changed
35
+ - **BREAKING**: `record_multiplayer_match` now raises `ArgumentError` for duplicate players instead of allowing self-matches
36
+ - **BREAKING**: `record_winner_vs_all` now validates winner and losers arrays upfront
37
+ - **BREAKING**: `record_draw` now validates both players upfront
38
+ - All validation errors now provide clear, descriptive error messages
39
+
40
+ ## [0.1.1] - 2025-08-07
41
+
42
+ ### Fixed
43
+ - Added proper input validation to `beat!`, `lost_to!`, and `draw_with!` methods
44
+ - Fixed SQLite3 gem version compatibility with ActiveRecord 8.0
45
+
46
+ ### Added
47
+ - Comprehensive edge case testing for high ratings, negative ratings, and invalid inputs
48
+ - Performance tests for leaderboard queries and association loading
49
+ - Input validation with descriptive error messages for nil players and self-matches
50
+
51
+ ### Changed
52
+ - Improved error handling with ArgumentError exceptions for invalid match scenarios
53
+ - Enhanced test suite with better coverage of edge cases and error conditions
54
+
55
+ ## [0.1.0] - 2025-08-06
56
+
57
+ ### Added
58
+ - Initial release
59
+ - `has_elo_ranking` macro for ActiveRecord models
60
+ - Support for 1v1 matches with `beat!`, `lost_to!`, and `draw_with!` methods
61
+ - Multiplayer ranked match support via `EloRankable.record_multiplayer_match`
62
+ - Winner-vs-all match support via `EloRankable.record_winner_vs_all`
63
+ - Configurable base rating and K-factor strategies
64
+ - Leaderboard scopes (`by_elo_rating`, `top_rated`)
65
+ - Polymorphic EloRanking model for clean separation
66
+ - Rails generator for database migration
67
+ - Comprehensive test suite
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 EloRankable Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 EloRankable Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.