ehbrs_ruby_utils 0.30.0 → 0.31.0
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/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress.rb +17 -0
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-12.target.yaml +20 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-19.source.html +8650 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-19.target.yaml +41 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93167144_2023-06-12.target.yaml +2 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93205235_2023-06-12.target.yaml +6 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93212034_2023-06-12.target.yaml +14 -0
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93223573_2023-06-12.target.yaml +3 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95babc114df8af9b04999592be5af6aae7865371f774c7d8b1c9e44a83900cfa
|
4
|
+
data.tar.gz: ec03e189177951420193f7ff68233db20675257f889cecc5b215fe6f10e0c43a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb85e43c2ff1aad41a7f9d838a44eea32d65799536bbe070ce490a95db5a9bb97e3c5b30884dce66bd6993ff148fcd47675c60d2b84f409dd4b9e61374c23bcf
|
7
|
+
data.tar.gz: 657ba445b150cb086e98e46f7b58ae0d6c11ca965ff3cf4f185d90e97e2568e67b98d0bd3249624bcf55a029da646c4600e0383ad13aaae58e785770fdd165c7
|
@@ -9,12 +9,29 @@ module EhbrsRubyUtils
|
|
9
9
|
class GameInProgress < ::Aranha::Parsers::Html::ItemList
|
10
10
|
ITEMS_XPATH = '//*[@id = "gametables_inprogress_all"]' \
|
11
11
|
'//*[starts-with(@id, "gametableblock_")]'
|
12
|
+
STATUS_CLASS_PATTERN = /\Agametable_status_(.+)\z/.freeze
|
13
|
+
STATUS_CLASS_PARSER = STATUS_CLASS_PATTERN.to_parser { |m| m[1] }
|
12
14
|
|
13
15
|
field :id, :integer, './@id'
|
16
|
+
field :status, :string, './@class'
|
17
|
+
|
18
|
+
def item_data(idd)
|
19
|
+
%i[status].each do |key|
|
20
|
+
idd[key] = send("process_#{key}", idd.fetch(key))
|
21
|
+
end
|
22
|
+
idd
|
23
|
+
end
|
14
24
|
|
15
25
|
def items_xpath
|
16
26
|
ITEMS_XPATH
|
17
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def process_status(status)
|
32
|
+
status.split(' ').lazy.map { |s| STATUS_CLASS_PARSER.parse(s.strip) }.find(&:present?) ||
|
33
|
+
raise("No status class found in \"#{status}\"")
|
34
|
+
end
|
18
35
|
end
|
19
36
|
end
|
20
37
|
end
|
@@ -1,21 +1,41 @@
|
|
1
1
|
---
|
2
2
|
- :id: 386538047
|
3
|
+
:status: asyncplay
|
3
4
|
- :id: 386107349
|
5
|
+
:status: asyncplay
|
4
6
|
- :id: 385834996
|
7
|
+
:status: asyncplay
|
5
8
|
- :id: 385698263
|
9
|
+
:status: asyncplay
|
6
10
|
- :id: 385694780
|
11
|
+
:status: asyncplay
|
7
12
|
- :id: 385359528
|
13
|
+
:status: asyncplay
|
8
14
|
- :id: 384903532
|
15
|
+
:status: asyncplay
|
9
16
|
- :id: 384212341
|
17
|
+
:status: asyncplay
|
10
18
|
- :id: 383714070
|
19
|
+
:status: asyncplay
|
11
20
|
- :id: 383403753
|
21
|
+
:status: asyncplay
|
12
22
|
- :id: 383405743
|
23
|
+
:status: asyncplay
|
13
24
|
- :id: 382781153
|
25
|
+
:status: asyncplay
|
14
26
|
- :id: 382715267
|
27
|
+
:status: asyncplay
|
15
28
|
- :id: 378760639
|
29
|
+
:status: asyncplay
|
16
30
|
- :id: 378760858
|
31
|
+
:status: asyncplay
|
17
32
|
- :id: 378698179
|
33
|
+
:status: asyncplay
|
18
34
|
- :id: 378397710
|
35
|
+
:status: asyncplay
|
19
36
|
- :id: 377545689
|
37
|
+
:status: asyncplay
|
20
38
|
- :id: 377079104
|
39
|
+
:status: asyncplay
|
21
40
|
- :id: 375601108
|
41
|
+
:status: asyncplay
|