class ThProvince::Geography

Public Class Methods

all() click to toggle source
# File lib/th_province/geography.rb, line 10
def self.all
  @@data.values
end
data() click to toggle source
# File lib/th_province/geography.rb, line 6
def self.data
  @@data
end
find(id) click to toggle source
# File lib/th_province/geography.rb, line 14
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/geography.rb, line 20
def initialize(json)
  @json = json
end

Public Instance Methods

amphurs() click to toggle source
# File lib/th_province/geography.rb, line 32
def amphurs
  ThProvince::Amphur.amphur_with_geography_id(@json["id"])
end
as_json() click to toggle source
# File lib/th_province/geography.rb, line 24
def as_json
  @json
end
districts() click to toggle source
# File lib/th_province/geography.rb, line 36
def districts
  ThProvince::District.districts_with_geography_id(@json["id"])
end
provinces() click to toggle source
# File lib/th_province/geography.rb, line 28
def provinces
  ThProvince::Province.provinces_with_geography_id(@json["id"])
end