module Propinsi

Constants

VERSION

Public Class Methods

all() click to toggle source

Your code goes here…

# 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) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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