ehbrs_ruby_utils 0.30.0 → 0.31.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: 3802f6228037cca931f88ce749cf512aa19c4c2e62a6ce91f35e81a8ea3e5928
4
- data.tar.gz: 433ae6d2b1dc7133920a5a6c10dddf6ae2170aff8a1f5d5e03dd88dd978de1fd
3
+ metadata.gz: 95babc114df8af9b04999592be5af6aae7865371f774c7d8b1c9e44a83900cfa
4
+ data.tar.gz: ec03e189177951420193f7ff68233db20675257f889cecc5b215fe6f10e0c43a
5
5
  SHA512:
6
- metadata.gz: 6c084798e36730906270e5ce96e9086527a75be3e5474af382ae03a67d2784aca2eb8ef110048f02fc5501f9113474eacbe3fd19f49491fbaf44f90393361fea
7
- data.tar.gz: 6fc1efe60241280dfe67da246075424285262d9ad1c24b3c467ac50aafd7b448388c5687e28b344e5061085ab55e0255ea885810bbfc0af4a7ca2d1aefc15abc
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,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.30.0'
4
+ VERSION = '0.31.0'
5
5
  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