npb 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: c93eb2ca7198495ee643bd94544f83623c3edf24
4
- data.tar.gz: c215b9566154e790d9c0068b69583732e0613aa1
3
+ metadata.gz: 9c99600c3f7ef031ab33718cc8f713d8208bfff7
4
+ data.tar.gz: 7d60a0105050a6cf3e84f580f8a04845624109da
5
5
  SHA512:
6
- metadata.gz: 7b3324409f4c7b36e92bd8c7e1724c7610669ba46521cdcfbad80bf400c26a3f5ac6f219c040dbe6b94367907fae553b7119041d0c0caf51cbb78ea433f83d8e
7
- data.tar.gz: 818bdd93c6c3f9d6c22a18baefda7e17ac147cdf62340ba34cb54f259a3103636d0fb1b2bc531a9169099d99450ef621ce20c477cfef9e299df13def288e13df
6
+ metadata.gz: 88a6b37f39b527dd0d1d4dfd4cbbb220251dccdbd5914f0dd6d7624b58121edd2628e15c0d7aae13cc936af93d68ea1ce460f4518045fbfb0eb7f586f468e26a
7
+ data.tar.gz: 8294bdcbf66c774b0e8d74a73840a96d82aec4dc7e3bf15b939c10012b9a19cf7bac0bf33e5dd2534f49d115f24a5516321017bf70a2ab81cb9fc138509e7e30
data/README.md CHANGED
@@ -22,7 +22,20 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ ```
26
+ pry(main)> require 'npb'
27
+ pry(main)> schedules = Npb::Schedule.all
28
+ processing 2015-03-23
29
+ processing 2015-03-30
30
+ processing 2015-04-06
31
+ ...
32
+ pry(main)> schedules.first
33
+ => #<Npb::Schedule:0x007f987a1fafd0
34
+ @home="巨人",
35
+ @start_at=2015-03-27 18:00:00 +0900,
36
+ @studium="東京ドーム",
37
+ @visitor="DeNA">
38
+ ```
26
39
 
27
40
  ## Development
28
41
 
data/lib/npb/schedule.rb CHANGED
@@ -5,7 +5,7 @@ require 'active_support/core_ext'
5
5
 
6
6
  module Npb
7
7
  class Schedule
8
- attr_accessor :home, :visitor, :studium, :start_at
8
+ attr_accessor :home, :visitor, :home_score, :visitor_score, :stadium, :start_at
9
9
 
10
10
  class << self
11
11
  def all
@@ -15,10 +15,13 @@ module Npb
15
15
  next if source.css('td').text.include?('試合はありません')
16
16
  @date = source.css('th').text if source.css('th').present?
17
17
  @time = source.css('td.pl7')[2].text.split[0]
18
+ @score = source.css('td.ct')[0].text
18
19
  arr << new(
19
20
  home: source.css('td.pl7')[0].text,
20
21
  visitor: source.css('td.pl7')[1].text,
21
- studium: source.css('td.pl7')[2].text.split[1],
22
+ home_score: home_score,
23
+ visitor_score: visitor_score,
24
+ stadium: source.css('td.pl7')[2].text.split[1],
22
25
  start_at: Time.new(2015, month, day, hour, minute)
23
26
  )
24
27
  end
@@ -57,12 +60,24 @@ module Npb
57
60
  @time =~ /\A(\d+):(\d+)\z/
58
61
  $2.to_i
59
62
  end
63
+
64
+ def home_score
65
+ @score =~ /\A(\d+)\s-\s(\d+)\z/
66
+ $1.to_i if $1
67
+ end
68
+
69
+ def visitor_score
70
+ @score =~ /\A(\d+)\s-\s(\d+)\z/
71
+ $2.to_i if $2
72
+ end
60
73
  end
61
74
 
62
- def initialize(home: nil, visitor: nil, studium: nil, start_at: nil)
75
+ def initialize(home: nil, visitor: nil, home_score: nil, visitor_score: nil, stadium: nil, start_at: nil)
63
76
  @home = home
64
77
  @visitor = visitor
65
- @studium = studium
78
+ @home_score = home_score
79
+ @visitor_score = visitor_score
80
+ @stadium = stadium
66
81
  @start_at = start_at
67
82
  end
68
83
  end
data/lib/npb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Npb
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/npb-0.1.2.gem ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: npb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ohtsuka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-12 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ files:
83
83
  - lib/npb.rb
84
84
  - lib/npb/schedule.rb
85
85
  - lib/npb/version.rb
86
- - npb-0.1.1.gem
86
+ - npb-0.1.2.gem
87
87
  - npb.gemspec
88
88
  homepage: https://github.com/to0526/npb_schedule
89
89
  licenses: []
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.6
107
+ rubygems_version: 2.4.7
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Write a short summary, because Rubygems requires one.
data/npb-0.1.1.gem DELETED
Binary file