national-rail 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -139,12 +139,15 @@ module NationalRail
139
139
  raise InputError.new((times_page.doc/".error-message").first.inner_text.gsub(/\s+/, " ").strip)
140
140
  end
141
141
 
142
- date = Date.parse((times_page.doc/".journey-details span").first.children.first.inner_text.gsub(/\s+/, " ").gsub(/\+ 1 day/, '').strip)
142
+ year = options[:time].year
143
+ date_as_string = (times_page.doc/".journey-details span").first.children.first.inner_text.gsub(/\s+/, " ").gsub(/\+ 1 day/, '').strip
144
+ date = Date.parse("#{date_as_string} #{year}")
143
145
 
144
146
  (times_page.doc/"table#outboundJourneyTable > tbody > tr").reject { |tr| %w(status changes).include?(tr.attributes["class"].value) }.each do |tr|
145
147
 
146
148
  if (tr.attributes["class"].value == "day-heading")
147
- date = Date.parse((tr/"th > p > span").first.inner_text.strip)
149
+ date_as_string = (tr/"th > p > span").first.inner_text.strip
150
+ date = Date.parse("#{date_as_string} #{year}")
148
151
  next
149
152
  end
150
153
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: national-rail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Mead
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-28 00:00:00 +00:00
18
+ date: 2010-12-31 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency