iarea 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iarea/area.rb +11 -1
- data/lib/iarea/version.rb +1 -1
- data/spec/iarea/area_spec.rb +5 -0
- metadata +15 -13
data/lib/iarea/area.rb
CHANGED
@@ -21,7 +21,17 @@ module Iarea
|
|
21
21
|
class << self
|
22
22
|
# Find area by <tt>areacode</tt>
|
23
23
|
def find(areacode)
|
24
|
-
|
24
|
+
if area = @@areas[areacode]
|
25
|
+
return area
|
26
|
+
else
|
27
|
+
if area_data = DB['area'][areacode]
|
28
|
+
area = new(area_data)
|
29
|
+
@@areas[areacode] = area
|
30
|
+
return area
|
31
|
+
else
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
end
|
25
35
|
end
|
26
36
|
|
27
37
|
# Find area by latitude and longitude in degrees
|
data/lib/iarea/version.rb
CHANGED
data/spec/iarea/area_spec.rb
CHANGED
@@ -49,6 +49,11 @@ describe Iarea::Area do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
context "finding by invalid id" do
|
53
|
+
subject { Iarea::Area.find("99999") }
|
54
|
+
it { should be_nil }
|
55
|
+
end
|
56
|
+
|
52
57
|
context "finding by id" do
|
53
58
|
subject { Iarea::Area.find("06304") }
|
54
59
|
its(:name) { should == "新宿1〜2丁目" }
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-06 00:00:00.000000000 +09:00
|
13
|
+
default_executable:
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: msgpack
|
16
|
-
requirement: &
|
17
|
+
requirement: &2157575000 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: '0'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *2157575000
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: rspec
|
27
|
-
requirement: &
|
28
|
+
requirement: &2157574580 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *2157574580
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: rdoc
|
38
|
-
requirement: &
|
39
|
+
requirement: &2157574160 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ! '>='
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
version: '0'
|
44
45
|
type: :development
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
+
version_requirements: *2157574160
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: rake
|
49
|
-
requirement: &
|
50
|
+
requirement: &2157573740 !ruby/object:Gem::Requirement
|
50
51
|
none: false
|
51
52
|
requirements:
|
52
53
|
- - ! '>='
|
@@ -54,10 +55,10 @@ dependencies:
|
|
54
55
|
version: '0'
|
55
56
|
type: :development
|
56
57
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
+
version_requirements: *2157573740
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
60
|
name: bundler
|
60
|
-
requirement: &
|
61
|
+
requirement: &2157573320 !ruby/object:Gem::Requirement
|
61
62
|
none: false
|
62
63
|
requirements:
|
63
64
|
- - ! '>='
|
@@ -65,7 +66,7 @@ dependencies:
|
|
65
66
|
version: '0'
|
66
67
|
type: :development
|
67
68
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
+
version_requirements: *2157573320
|
69
70
|
description: A library for DoCoMo Open Iarea.
|
70
71
|
email:
|
71
72
|
- dara@shidara.net
|
@@ -98,6 +99,7 @@ files:
|
|
98
99
|
- spec/iarea/zone_spec.rb
|
99
100
|
- spec/spec_helper.rb
|
100
101
|
- tools/generate.rb
|
102
|
+
has_rdoc: true
|
101
103
|
homepage: http://github.com/darashi/iarea
|
102
104
|
licenses: []
|
103
105
|
post_install_message:
|
@@ -118,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
120
|
version: '0'
|
119
121
|
requirements: []
|
120
122
|
rubyforge_project: iarea
|
121
|
-
rubygems_version: 1.
|
123
|
+
rubygems_version: 1.6.1
|
122
124
|
signing_key:
|
123
125
|
specification_version: 3
|
124
126
|
summary: A library for DoCoMo Open Iarea.
|