iarea 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iarea/area.rb +4 -8
- data/lib/iarea/prefecture.rb +7 -1
- data/lib/iarea/version.rb +1 -1
- data/lib/iarea/zone.rb +7 -1
- data/spec/iarea/area_spec.rb +6 -0
- data/spec/iarea/prefecture_spec.rb +6 -0
- data/spec/iarea/zone_spec.rb +6 -0
- metadata +13 -15
data/lib/iarea/area.rb
CHANGED
@@ -22,15 +22,11 @@ module Iarea
|
|
22
22
|
# Find area by <tt>areacode</tt>
|
23
23
|
def find(areacode)
|
24
24
|
if area = @@areas[areacode]
|
25
|
-
|
25
|
+
area
|
26
|
+
elsif area_data = DB['area'][areacode]
|
27
|
+
@@areas[areacode] ||= new(area_data)
|
26
28
|
else
|
27
|
-
|
28
|
-
area = new(area_data)
|
29
|
-
@@areas[areacode] = area
|
30
|
-
return area
|
31
|
-
else
|
32
|
-
return nil
|
33
|
-
end
|
29
|
+
nil
|
34
30
|
end
|
35
31
|
end
|
36
32
|
|
data/lib/iarea/prefecture.rb
CHANGED
@@ -16,7 +16,13 @@ module Iarea
|
|
16
16
|
class << self
|
17
17
|
# Find a prefecture by <tt>id</tt>
|
18
18
|
def find(id)
|
19
|
-
|
19
|
+
if prefecture = @@prefectures[id.to_i]
|
20
|
+
prefecture
|
21
|
+
elsif prefecture_data = DB['prefecture'][id.to_i]
|
22
|
+
@@prefectures[id.to_i] ||= new(prefecture_data)
|
23
|
+
else
|
24
|
+
nil
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
# All prefectures
|
data/lib/iarea/version.rb
CHANGED
data/lib/iarea/zone.rb
CHANGED
@@ -15,7 +15,13 @@ module Iarea
|
|
15
15
|
class << self
|
16
16
|
# Find a zone by <tt>id</tt>
|
17
17
|
def find(id)
|
18
|
-
|
18
|
+
if zone = @@zones[id.to_i]
|
19
|
+
zone
|
20
|
+
elsif zone_data = DB['zone'][id.to_i]
|
21
|
+
@@zones[id.to_i] ||= new(zone_data)
|
22
|
+
else
|
23
|
+
nil
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
# All zones
|
data/spec/iarea/area_spec.rb
CHANGED
data/spec/iarea/zone_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iarea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-09-28 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: msgpack
|
17
|
-
requirement: &
|
16
|
+
requirement: &2158142580 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: '0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *2158142580
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: rspec
|
28
|
-
requirement: &
|
27
|
+
requirement: &2158142160 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: '0'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *2158142160
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: rdoc
|
39
|
-
requirement: &
|
38
|
+
requirement: &2158141740 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ! '>='
|
@@ -44,10 +43,10 @@ dependencies:
|
|
44
43
|
version: '0'
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *2158141740
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: rake
|
50
|
-
requirement: &
|
49
|
+
requirement: &2158141320 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ! '>='
|
@@ -55,10 +54,10 @@ dependencies:
|
|
55
54
|
version: '0'
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
57
|
+
version_requirements: *2158141320
|
59
58
|
- !ruby/object:Gem::Dependency
|
60
59
|
name: bundler
|
61
|
-
requirement: &
|
60
|
+
requirement: &2158140900 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
62
|
requirements:
|
64
63
|
- - ! '>='
|
@@ -66,7 +65,7 @@ dependencies:
|
|
66
65
|
version: '0'
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *2158140900
|
70
69
|
description: A library for DoCoMo Open Iarea.
|
71
70
|
email:
|
72
71
|
- dara@shidara.net
|
@@ -99,7 +98,6 @@ files:
|
|
99
98
|
- spec/iarea/zone_spec.rb
|
100
99
|
- spec/spec_helper.rb
|
101
100
|
- tools/generate.rb
|
102
|
-
has_rdoc: true
|
103
101
|
homepage: http://github.com/darashi/iarea
|
104
102
|
licenses: []
|
105
103
|
post_install_message:
|
@@ -120,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
118
|
version: '0'
|
121
119
|
requirements: []
|
122
120
|
rubyforge_project: iarea
|
123
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.8.3
|
124
122
|
signing_key:
|
125
123
|
specification_version: 3
|
126
124
|
summary: A library for DoCoMo Open Iarea.
|