Sha256: 73f6c43847826157ae9bd44c06052002db510183c9eae3be53744af5f072268a

Contents?: true

Size: 529 Bytes

Versions: 5

Compression:

Stored size: 529 Bytes

Contents

module ISO
  module UN
    class Region < ISO::Region
      DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../../data/un-m49.yml"

      attr_reader :iso_code

      def initialize(code, options={})
        @iso_code = options[:iso_code]
        super(code, options)
      end
      
      def name
        return super if iso_code.nil?
        @options[:name] || I18n.t(iso_code, :scope => i18n_scope)
      end

      def self.identify(full_code)
        full_code =~ /-(\d{3})$/ ? find($1) : nil
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iso-0.4.0 lib/iso/un/region.rb
iso-0.3.0 lib/iso/un/region.rb
iso-0.2.2 lib/iso/un/region.rb
iso-0.2.1 lib/iso/un/region.rb
iso-0.2.0 lib/iso/un/region.rb