luzvimin 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -2
- data/lib/luzvimin.rb +2 -2
- data/lib/luzvimin/version.rb +1 -1
- data/spec/luzvimin_region_spec.rb +3 -3
- data/spec/luzvimin_spec.rb +3 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Luzvimin
|
2
2
|
|
3
|
-
|
3
|
+
Luzvimin is a gem that lists all regions and provinces in the Philippines
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,27 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
To list all regions:
|
22
|
+
|
23
|
+
Luzvimin.regions
|
24
|
+
|
25
|
+
To create a select tag for all regions:
|
26
|
+
|
27
|
+
Luzvimin.select_regions
|
28
|
+
|
29
|
+
To get details about a region:
|
30
|
+
|
31
|
+
region = Luzvimin.region('NCR')
|
32
|
+
region.code is 'NCR'.
|
33
|
+
region.name is 'National Capital Region'.
|
34
|
+
|
35
|
+
To get a region's provinces:
|
36
|
+
|
37
|
+
region.provinces
|
38
|
+
|
39
|
+
To create a select tag for all region's provinces:
|
40
|
+
|
41
|
+
region.select_provinces
|
22
42
|
|
23
43
|
## Contributing
|
24
44
|
|
data/lib/luzvimin.rb
CHANGED
@@ -25,7 +25,7 @@ module Luzvimin
|
|
25
25
|
provinces.map { |k, v| [k, v] }.sort_by{ |k, v| v['position'] }
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def provinces_options_for_select
|
29
29
|
provinces.map {|s| [s[1]['name'],s[0]]}
|
30
30
|
end
|
31
31
|
end
|
@@ -39,7 +39,7 @@ module Luzvimin
|
|
39
39
|
REGIONS
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def regions_options_for_select
|
43
43
|
REGIONS.map {|s| [s[1]['name'],s[0]]}
|
44
44
|
end
|
45
45
|
end
|
data/lib/luzvimin/version.rb
CHANGED
@@ -30,15 +30,15 @@ describe Luzvimin::Region do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe '
|
33
|
+
describe 'provinces_options_for_select' do
|
34
34
|
context 'all' do
|
35
|
-
subject { region.
|
35
|
+
subject { region.provinces_options_for_select }
|
36
36
|
it { should be_an(Array) }
|
37
37
|
it { should have(1).items }
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'first province' do
|
41
|
-
subject { region.
|
41
|
+
subject { region.provinces_options_for_select.first }
|
42
42
|
it { should be_an(Array) }
|
43
43
|
it { should_not be_empty }
|
44
44
|
it { should have(2).items }
|
data/spec/luzvimin_spec.rb
CHANGED
@@ -25,15 +25,15 @@ describe Luzvimin do
|
|
25
25
|
it { Luzvimin.regions.first.should be_an(Array) }
|
26
26
|
end
|
27
27
|
|
28
|
-
describe '
|
28
|
+
describe 'regions_options_for_select' do
|
29
29
|
context 'all' do
|
30
|
-
subject { Luzvimin.
|
30
|
+
subject { Luzvimin.regions_options_for_select }
|
31
31
|
it { should be_an(Array) }
|
32
32
|
it { should have(17).items }
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'first region' do
|
36
|
-
subject { Luzvimin.
|
36
|
+
subject { Luzvimin.regions_options_for_select.first }
|
37
37
|
it { should be_an(Array) }
|
38
38
|
it { should_not be_empty }
|
39
39
|
it { should have(2).items }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luzvimin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|