atp_scraper 0.7.0 → 0.7.2

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
  SHA1:
3
- metadata.gz: cf41c60c931d5768918495f359ddef7f7259a6f1
4
- data.tar.gz: d2b5b399f25d6ddfa435d2a186959df8696fba2a
3
+ metadata.gz: d4bfa1a9cf5f055d98682a6ae73c8c6ebc25d078
4
+ data.tar.gz: 95c75134b8011b3375493632e9ce6f0d7c803f54
5
5
  SHA512:
6
- metadata.gz: 5ea5ede9220201004e477aebe4dde01342b8a69b4f0140624197579ede8b123109ff4d81456e75461d23ad7be3f675b157761de64a3d448136f18e457f708c57
7
- data.tar.gz: c183e7235ee10fa9c413fdee17cee983f6bd2ef371135fd9f348cff7f8d83d1db9d43eb0642f93c0e857bb358dd8bbb930f81f513abd1d95bad6d8246ef169b5
6
+ metadata.gz: 473138f4c22867179c802ec1ecaea81d3f7087aae761e52f6adb7be5ed40aa135cb2046f18f530cdc018132b76a148c65fac93c0d9b85b463ba210b6ad9bf96b
7
+ data.tar.gz: b4777082f9b9055a021c2013120f24f9b956044d0e3d5ffb6a5e69709203533dbabc117d8495a001d1dfffce08c6765cfec2012bdef07d2816f7f02314c12e55
data/README.md CHANGED
@@ -50,7 +50,7 @@ AtpScraper::Get.player_activity("n409", 2016)
50
50
  # opponent_name: "Fernand Verdasco",
51
51
  # opponent_rank: "45",
52
52
  # round: "Round of 128",
53
- # score: "673 64 63 674 26",
53
+ # score: "67(3) 64 63 67(4) 26",
54
54
  # win_loss: "L",
55
55
  # tournament_name: "Australian Open",
56
56
  # tournament_category: "grandslam",
@@ -1,5 +1,6 @@
1
1
  require "atp_scraper/version"
2
2
  require "atp_scraper/get"
3
+ require "atp_scraper/utility"
3
4
  require "atp_scraper/html"
4
5
  require "atp_scraper/activity"
5
6
  require "atp_scraper/ranking"
@@ -20,7 +20,7 @@ module AtpScraper
20
20
  when 3 then
21
21
  result[:win_loss] = record_content
22
22
  when 4 then
23
- result[:score] = record_content
23
+ result[:score] = AtpScraper::Utility.convert_score(record_content)
24
24
  end
25
25
  end
26
26
  result
@@ -0,0 +1,20 @@
1
+ module AtpScraper
2
+ # Utility class
3
+ class Utility
4
+ # "62 765" -> "62 76(5)"
5
+ # "768 64 46 46 76-74" -> "76(8) 64 46 46 76-74"
6
+ # "76 63" -> "76 64"
7
+ def self.convert_score(score)
8
+ result = []
9
+ score.split("\s").each do |s|
10
+ # Str starts '76' or '67' (not '76-' or '67-')
11
+ if (a = s.slice!(/^(76|67)(?!-|$)/))
12
+ result.push("#{a}(#{s})")
13
+ else
14
+ result.push(s)
15
+ end
16
+ end
17
+ result.join("\s")
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module AtpScraper
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atp_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mosuke5
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-07 00:00:00.000000000 Z
11
+ date: 2016-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -176,6 +176,7 @@ files:
176
176
  - lib/atp_scraper/get.rb
177
177
  - lib/atp_scraper/html.rb
178
178
  - lib/atp_scraper/ranking.rb
179
+ - lib/atp_scraper/utility.rb
179
180
  - lib/atp_scraper/version.rb
180
181
  homepage: https://github.com/mosuke5/atp_scraper
181
182
  licenses: