Sha256: d525e860c7831fa18ece3f3c6f108bccd08e888239a1d68a6d3d4f5a59b16371
Contents?: true
Size: 700 Bytes
Versions: 1
Compression:
Stored size: 700 Bytes
Contents
module Iso module Country module InstanceMethods attr_reader :id, :alpha2, :alpha3, :numeric def initialize(alpha2, alpha3, numeric, localizedNames = {}) @id = alpha2.downcase.to_sym @alpha2 = alpha2 @alpha3 = alpha3 @numeric = numeric.to_i @localizedNames = localizedNames end def names @localizedNames end def name(locale = :en) if @localizedNames.empty? "#{alpha3} (#{"%03d" % numeric})" else @localizedNames[locale] end end alias :__to_s :to_s def to_s name end def inspect __to_s() end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iso-country-0.1.1 | lib/iso-country/instance.rb |