Class: ISO::UN::Region
Constant Summary collapse
- DEFINITIONS_FILE =
"#{File.dirname(__FILE__)}/../../../data/un-m49.yml"
Instance Attribute Summary collapse
-
#iso_code ⇒ Object
readonly
Returns the value of attribute iso_code.
Attributes inherited from Subtag
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, options = {}) ⇒ Region
constructor
A new instance of Region.
- #name ⇒ Object
Methods inherited from Subtag
#==, all, codes, default, find, #full_name
Constructor Details
#initialize(code, options = {}) ⇒ Region
Returns a new instance of Region.
8 9 10 11 |
# File 'lib/iso/un/region.rb', line 8 def initialize(code, ={}) @iso_code = [:iso_code] super(code, ) end |
Instance Attribute Details
#iso_code ⇒ Object (readonly)
Returns the value of attribute iso_code.
6 7 8 |
# File 'lib/iso/un/region.rb', line 6 def iso_code @iso_code end |
Class Method Details
.identify(full_code) ⇒ Object
18 19 20 |
# File 'lib/iso/un/region.rb', line 18 def self.identify(full_code) full_code =~ /-(\d{3})$/ ? find($1) : nil end |
Instance Method Details
#name ⇒ Object
13 14 15 16 |
# File 'lib/iso/un/region.rb', line 13 def name return super if iso_code.nil? @options[:name] || I18n.t(iso_code, :scope => i18n_scope) end |