class ThProvince::Amphur
Public Class Methods
all()
click to toggle source
# File lib/th_province/amphur.rb, line 11 def self.all @@data.values end
amphurs_with_geography_id(geography_id)
click to toggle source
# File lib/th_province/amphur.rb, line 41 def self.amphurs_with_geography_id(geography_id) arr = @@geography_id_to_data[geography_id] arr.map{|a| self.new(a)} end
amphurs_with_province_id(province_id)
click to toggle source
# File lib/th_province/amphur.rb, line 46 def self.amphurs_with_province_id(province_id) arr = @@province_id_to_data[province_id] arr.map{|a| self.new(a)} end
data()
click to toggle source
# File lib/th_province/amphur.rb, line 7 def self.data @@data end
find(id)
click to toggle source
# File lib/th_province/amphur.rb, line 15 def self.find(id) json = @@data[id.to_s] return self.new(@@data[id.to_s]) if !json.nil? nil end
new(json)
click to toggle source
# File lib/th_province/amphur.rb, line 21 def initialize(json) @json = json end
Public Instance Methods
as_json()
click to toggle source
# File lib/th_province/amphur.rb, line 25 def as_json @json end
districts()
click to toggle source
# File lib/th_province/amphur.rb, line 37 def districts ThProvince::District.districts_with_amphur_id(@json["id"]) end
geography()
click to toggle source
# File lib/th_province/amphur.rb, line 29 def geography ThProvince::Geography.find(@json["geography_id"]) end
province()
click to toggle source
# File lib/th_province/amphur.rb, line 33 def province ThProvince::Province.find(@json["province_id"]) end