jp_station 0.1.1 → 0.1.2

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: 3855f33ac25ecd9e834840d509b2b59392d74670
4
- data.tar.gz: 9319595c9f1b72753ea367bf5b2517d0a7682ad4
3
+ metadata.gz: 8bd429909067737bf6a076bb45e898c71997beef
4
+ data.tar.gz: 62844d92dd81316ae74cd80b5a9988be13d1bbe9
5
5
  SHA512:
6
- metadata.gz: cfe025d296ef90041cb8876b1c875fbb5f7339a8581224a58c58fcd2b8e863fac43b0c808dbd486d39c7983afa2713b3ab01cfaa6e2d98cd5514e89dc2f1de0e
7
- data.tar.gz: 5295336584052d1b482bb8a89d7a2651f1a0795eac068acf06cab0d041c1971da34caf4d372d9e886e48c77f3f1d16955a1e6e10e0436a75f14987c7a859b412
6
+ metadata.gz: b92c6b6fce0aea305f49abf475b5d7932bca8bdf11cd5e16e65ca4f052f13cdbad16f2028810cec58504cc152a5e9205b35b2e2c3b5e972e079a866f8a095507
7
+ data.tar.gz: 1be9768510b36a16dca53f6822bfbfab607acba97b19d980574566b643754d0b383ed98ff719e3c1b6f9266185e7dfa52295c00af2ec8e42c5d5f4f5904358a1
@@ -30,19 +30,23 @@ module JpStation
30
30
 
31
31
  def station_hash(station)
32
32
  {
33
- :name => station.elements["name"].text,
34
- :furigana => station.elements["furigana"].text,
35
- :line => station.elements["line"].text,
36
- :city => station.elements["city"].text,
37
- :prefecture => station.elements["prefecture"].text,
38
- :direction => station.elements["direction"].text,
39
- :directionReverse => station.elements["directionReverse"].text,
40
- :distance => station.elements["distance"].text,
41
- :distanceM => station.elements["distanceM"].text,
42
- :distanceKm => station.elements["distanceKm"].text,
43
- :traveltime => station.elements["traveltime"].text
33
+ :name => blank_if_nil( station.elements["name"] ),
34
+ :furigana => blank_if_nil( station.elements["furigana"] ),
35
+ :line => blank_if_nil( station.elements["line"] ),
36
+ :city => blank_if_nil( station.elements["city"] ),
37
+ :prefecture => blank_if_nil( station.elements["prefecture"] ),
38
+ :direction => blank_if_nil( station.elements["direction"] ),
39
+ :directionReverse => blank_if_nil( station.elements["directionReverse"] ),
40
+ :distance => blank_if_nil( station.elements["distance"] ),
41
+ :distanceM => blank_if_nil( station.elements["distanceM"] ),
42
+ :distanceKm => blank_if_nil( station.elements["distanceKm"] ),
43
+ :traveltime => blank_if_nil( station.elements["traveltime"] )
44
44
  }
45
45
  end
46
+
47
+ def blank_if_nil(element)
48
+ element ? element.text : ""
49
+ end
46
50
  end
47
51
  end
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module JpStation
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jp_station
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takayoshi Nishida
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler