elo_rankable 0.1.2 → 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 +4 -4
- data/.rspec +3 -3
- data/.rubocop.yml +37 -34
- data/CHANGELOG.md +67 -59
- data/LICENSE.txt +21 -21
- data/README.md +305 -309
- data/Rakefile +12 -12
- data/elo_rankable.gemspec +36 -36
- data/lib/elo_rankable/calculator.rb +67 -67
- data/lib/elo_rankable/configuration.rb +42 -42
- data/lib/elo_rankable/elo_ranking.rb +23 -23
- data/lib/elo_rankable/has_elo_ranking.rb +71 -73
- data/lib/elo_rankable/version.rb +5 -5
- data/lib/elo_rankable.rb +96 -96
- data/lib/generators/elo_rankable/install/install_generator.rb +21 -21
- data/lib/generators/elo_rankable/install/templates/create_elo_rankings.rb +16 -16
- metadata +9 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5301ca9d389672548e302fc188a284b615dfe051d6eb567a4414616fe9b3844e
|
|
4
|
+
data.tar.gz: 5e95c93f2f631c50650b3a5795f6a27a848df764f5a06f8c337760b093291d5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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,35 +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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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:
|
|
35
38
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,59 +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.1
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **BREAKING**:
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
###
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
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.
|