Sha256: af05cfa7d4014b0700ab2c7e18db918a98fa92841896ee59b7830937516a5e00
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
class IsoCountry attr_accessor :name, :alpha2, :alpha3 def initialize(data={}) if data and !data.nil? data.each do |k, v| send("#{k}=", v) if self.respond_to? "#{k}=" end end end class << self def all COUNTRIES[:alpha2].values end def find_by_name(name) COUNTRIES[:name][name] end alias_method :name, :find_by_name def find_by_alpha2(code) COUNTRIES[:alpha2][code.to_s.upcase] end alias_method :alpha2, :find_by_alpha2 def find_by_alpha3(code) COUNTRIES[:alpha3][code.to_s.upcase] end alias_method :alpha3, :find_by_alpha3 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iso_countries_plus-0.1.0 | lib/iso_countries_plus/iso_country.rb |