sports-manager 0.0.2 → 0.0.3

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: b731114e4613bcf2ba9f6f094379b2a96d8f14cadcd960e3b2c431abcacb5fbe
4
- data.tar.gz: 5855311009ef5e3515ed7e8dc1eec7a0230dba4286eeeafbd21aac4a9a94dd58
3
+ metadata.gz: 896fa713f3fa999a6d852b8987a626998201f976a48c382297944bd0068488e9
4
+ data.tar.gz: e3f14be9cd4eaa4edf88a084ae4d041afd70800c536177fed88f20e5bb8be02c
5
5
  SHA512:
6
- metadata.gz: 5f28109152d33f3261bad872f0692abd4c12211ccfed951f6398e6cf2d42856b6e10a6f0805e90918871b78e0f61ffd74b00bccaa77c56abff96ad280a3d63f1
7
- data.tar.gz: 9c5dbc73ea1cb60a4861f1c7a4e3fb5eeb3415675b2f7d2e9e0babfa410534bab7ea545837e292c4c7f7a8182a8231741f35095c67e20a725721f229bc1c4b21
6
+ metadata.gz: '099e7f7e9049254d6ee2b68a34acb263308235f0d67e829fbaaff182b3cb59fbbbb75ab52471fd620af2c31551630008fc0613719ef2d4f802e4a19f9e57807e'
7
+ data.tar.gz: e2e7c3057107fd7ae76f1dcb364246003cf8ff889fc1a9ad4f8a5aee42cbfaa580c944d33455eef1cb0dc72a37ead9b087c25799adee3e2e465f9c789bc2c0ed
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timeout'
4
+
3
5
  # rubocop:disable Metrics/AbcSize
4
6
  module SportsManager
5
7
  # Public:Tournament Solver
@@ -22,7 +24,7 @@ module SportsManager
22
24
  extend Forwardable
23
25
 
24
26
  attr_reader :format, :tournament, :variables, :domains,
25
- :ordering, :filtering, :lookahead, :csp
27
+ :ordering, :filtering, :lookahead, :csp, :timeout
26
28
 
27
29
  attr_accessor :days, :subscriptions, :matches, :courts, :game_length, :rest_break, :single_day_matches,
28
30
  :tournament_type
@@ -43,8 +45,9 @@ module SportsManager
43
45
  .call
44
46
  end
45
47
 
46
- def initialize(format: :cli)
48
+ def initialize(format: :cli, timeout: nil)
47
49
  @format = format
50
+ @timeout = timeout
48
51
  @days = {}
49
52
  @subscriptions = {}
50
53
  @matches = {}
@@ -129,7 +132,7 @@ module SportsManager
129
132
  def call
130
133
  setup
131
134
 
132
- solutions = csp.solve
135
+ solutions = Timeout.timeout(timeout) { csp.solve }
133
136
 
134
137
  TournamentSolution
135
138
  .new(tournament: tournament, solutions: solutions)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SportsManager
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Benjamim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-08-26 00:00:00.000000000 Z
12
+ date: 2024-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: csp-resolver