golfscrape 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,6 +59,24 @@ module Golfscrape
59
59
  response = []
60
60
  url = "http://espn.go.com/golf/schedule"
61
61
  doc = Nokogiri::HTML(open(url))
62
+
63
+ events_curr = doc.css('table.tablehead')[0].css('tr')
64
+
65
+ events_curr.each do |event|
66
+ begin
67
+ unless events.index(event) == 0 || events.index(event) == 1
68
+ @dates = event.css('td').css('nobr').first.children.first.content.split(" - ")
69
+ @start_date = Time.parse(@dates.first)
70
+ @end_date = Time.parse(@dates.last)
71
+ @name = event.css('td')[1].children.first.content
72
+ @location = event.css('td')[1].css('em').first.children.first.content
73
+ end
74
+ rescue
75
+ end
76
+
77
+ response << Hashie::Mash.new(:start_date => @start_date, :end_date => @end_date, :name => @name, :location => @location)
78
+ end
79
+
62
80
  events = doc.css('table.tablehead')[2].css('tr')
63
81
  events.each do |event|
64
82
  begin
@@ -1,3 +1,3 @@
1
1
  module Golfscrape
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golfscrape
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Johnny Khai Nguyen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-23 00:00:00 -05:00
18
+ date: 2011-07-11 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency