ehbrs_ruby_utils 0.39.0 → 0.40.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: '089b6f1fa3dd8f8ce4ba9414e089d522d2e9eaaf78f6a6004c323c31392639aa'
4
- data.tar.gz: 811149efacf1d16ce127eb68acc18ce078c4ea066276d321e0c176590690be06
3
+ metadata.gz: 86fcf26dbec53e9e7e2b04d2197849a7f17ad0850b07d4420e26a115841c3a32
4
+ data.tar.gz: 3a62e456a9d8965f914b47ccd483a92656058cc0a59f99aef595c772fdfeb05e
5
5
  SHA512:
6
- metadata.gz: 9d4dab607225cf32244eabd21352ca551251ddd41bc789a46dc6bab10d2d298371d3dcb727acb2c1defb299409f1ccda2adf43f7213529d48267bd5cd636d815
7
- data.tar.gz: 8fb1e6240cd3985f8b78b6932d778578dc3e88777561eb0f26bdc168195450ebaf1b3859a04f943558474cd7645baa483fbe9837d5ffa05cee93bc25375fb8e0
6
+ metadata.gz: 171835d362844886ba8032527dd298a8da9913b9a699570686252a35209c8976e77e658ef9ca22a2e386313386a68a1dfc064298832bc9e4a8c622be6a06f89a
7
+ data.tar.gz: 1b03d32256cbf9e3e27dafd52acaac5ae977a0911d014da72ef97b9ef3ba3ff10e66b62208b139d60a42efc0626b320ba226c6b24dfd1cdbab3310b0eeb3cce6
@@ -17,7 +17,8 @@ module EhbrsRubyUtils
17
17
 
18
18
  # @return [String, nil]
19
19
  def username_by_tables
20
- formatter.game_tables.lazy.map { |table| username_by_table(table) }.find(&:present?)
20
+ formatter.with_players_tables.lazy.map { |table| username_by_table(table) }
21
+ .find(&:present?)
21
22
  end
22
23
 
23
24
  # @param table [EhbrsRubyUtils::Bga::Table]
@@ -14,12 +14,8 @@ module EhbrsRubyUtils
14
14
 
15
15
  enable_simple_cache
16
16
  common_constructor :game_statistics
17
- delegate :game, :game_tables, :players, :until_table, to: :game_statistics
18
-
19
- # @return [Integer]
20
- def friendly_tables_count
21
- game_tables.count - normal_tables.count
22
- end
17
+ delegate :game, :friendly_tables_count, :normal_tables, :players, :until_table,
18
+ :with_players_tables, to: :game_statistics
23
19
 
24
20
  # @return [Hash]
25
21
  def root_content
@@ -45,23 +41,6 @@ module EhbrsRubyUtils
45
41
 
46
42
  private
47
43
 
48
- # @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
49
- def normal_tables_uncached
50
- with_players_tables.reject(&:friendly?)
51
- end
52
-
53
- # @param table [EhbrsRubyUtils::Bga::Table]
54
- # @return [Boolean]
55
- def with_players_table?(table)
56
- table.players.count == players.count &&
57
- players.all? { |player| table.player_by_id(player.id).present? }
58
- end
59
-
60
- # @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
61
- def with_players_tables_uncached
62
- game_tables.select { |table| with_players_table?(table) }
63
- end
64
-
65
44
  # @return [Array<Integer>]
66
45
  def ranks_uncached
67
46
  r = ::Set.new
@@ -5,8 +5,33 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EhbrsRubyUtils
6
6
  module Bga
7
7
  class GameStatistics
8
+ enable_simple_cache
8
9
  common_constructor :game, :game_tables, :players, :until_table, default: [nil]
9
10
 
11
+ # @return [Integer]
12
+ def friendly_tables_count
13
+ with_players_tables.count - normal_tables.count
14
+ end
15
+
16
+ private
17
+
18
+ # @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
19
+ def normal_tables_uncached
20
+ with_players_tables.reject(&:friendly?)
21
+ end
22
+
23
+ # @param table [EhbrsRubyUtils::Bga::Table]
24
+ # @return [Boolean]
25
+ def with_players_table?(table)
26
+ table.players.count == players.count &&
27
+ players.all? { |player| table.player_by_id(player.id).present? }
28
+ end
29
+
30
+ # @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
31
+ def with_players_tables_uncached
32
+ game_tables.select { |table| with_players_table?(table) }
33
+ end
34
+
10
35
  require_sub __FILE__
11
36
  end
12
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.39.0'
4
+ VERSION = '0.40.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.0
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha