Sha256: 84b62680885030845059ff5102b5cb6db5e665c88794d58cb617e8bd9b2c2a5d
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# encoding: UTF-8 require 'json' require 'iso-country/version' require 'iso-country/data' require 'iso-country/exceptions' require 'iso-country/finders' require 'iso-country/instance' require 'iso-country/mongoid' module Iso module Country include Iso::Country::Exceptions include Iso::Country::Data class Country include Iso::Country::InstanceMethods @countries = {} def self.demongoize(country) find(country) end def self.evolve(country) country.id end Iso::Country::Data::DICTIONARY[:countries].each do |c| localizations = {} if Iso::Country::Data::DICTIONARY[:localizations][c['alpha-2']] localizations = Iso::Country::Data::DICTIONARY[:localizations][c['alpha-2']].inject({}){|memo, (k,v)| memo[k.to_sym] = v; memo} end country = Country.new(c['alpha-2'], c['alpha-3'], c['numeric'], localizations) @countries[country.id] = country end extend Iso::Country::Finders include Iso::Country::Mongoid end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iso-country-0.1.1 | lib/iso-country.rb |
iso-country-0.1.0 | lib/iso-country.rb |