Module: Propinsi
- Defined in:
- lib/propinsi.rb,
lib/propinsi/version.rb,
lib/generators/propinsi/kota_generator.rb,
lib/generators/propinsi/install_generator.rb,
lib/generators/propinsi/propinsi_generator.rb
Defined Under Namespace
Classes: InstallGenerator, KotaGenerator, PropinsiGenerator
Constant Summary
collapse
- VERSION =
"0.0.6"
Class Method Summary
collapse
Class Method Details
.all ⇒ Object
5
6
7
8
9
|
# File 'lib/propinsi.rb', line 5
def Propinsi.all
filepath = File.join(File.dirname(__FILE__), 'data/all.yml')
all=YAML.load_file(filepath);
return all["provinces"]
end
|
.findkota(input) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/propinsi.rb', line 23
def Propinsi.findkota(input)
kota=self.kota;
index=kota.each_with_index do |row,idx|
break idx if(input.to_s == row["id"].to_s || row["name"].to_s.downcase[input.to_s.downcase])
end
if index.kind_of?(Array)
return false;
else
return kota[index]
end
end
|
.findpropinsi(input) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/propinsi.rb', line 36
def Propinsi.findpropinsi(input)
prop=self.propinsi
index=prop.each_with_index do |row,idx|
break idx if(input.to_s == row["id"].to_s || row["name"].to_s.downcase[input.to_s.downcase])
end
if index.kind_of?(Array)
return false;
else
return prop[index]
end
end
|
.kota ⇒ Object
17
18
19
20
21
|
# File 'lib/propinsi.rb', line 17
def Propinsi.kota
filepath = File.join(File.dirname(__FILE__), 'data/cities.yml')
kota=YAML.load_file(filepath);
return kota["cities"];
end
|
.propinsi ⇒ Object
11
12
13
14
15
|
# File 'lib/propinsi.rb', line 11
def Propinsi.propinsi
filepath = File.join(File.dirname(__FILE__), 'data/provinces.yml')
prop=YAML.load_file(filepath);
return prop["provinces"]
end
|