Struct.new(:name, :country_code, :char_2_code, :char_3_code, :area_code)
# File lib/country.rb, line 21 def self.find_by_country_code(code) @@all[code] end
# File lib/country.rb, line 25 def self.find_by_country_isocode(isocode) if country = @@all.detect{|c|c[1].char_3_code.downcase == isocode} country[1] end end
# File lib/country.rb, line 5 def self.load return @@all if @@all.present? data_file = File.join(File.dirname(__FILE__), '..', 'data', 'phone_countries.yml') @@all = {} YAML.load(File.read(data_file)).each_pair do |key, c| @@all[key] = Country.new(c[:name], c[:country_code], c[:char_2_code], c[:char_3_code], c[:area_code]) end @@all end
Generated with the Darkfish Rdoc Generator 2.