Class: Locale::Info::Region
- Inherits:
-
Object
- Object
- Locale::Info::Region
- Defined in:
- lib/locale/info/region.rb
Overview
This class models out a region/country from the ISO 3166 standard for region codes. In ISO3166, it’s called “Country” but Ruby/Locale the word “Region” instead.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(code, name) ⇒ Region
constructor
- code
-
The 2 or 3 digit ISO 3166 region code.
- #iso_region? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(code, name) ⇒ Region
- code
-
The 2 or 3 digit ISO 3166 region code.
- name
-
The name of the region.
25 26 27 28 |
# File 'lib/locale/info/region.rb', line 25 def initialize(code, name) @code = code @name = name end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
21 22 23 |
# File 'lib/locale/info/region.rb', line 21 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/locale/info/region.rb', line 21 def name @name end |
Instance Method Details
#iso_region? ⇒ Boolean
30 31 32 |
# File 'lib/locale/info/region.rb', line 30 def iso_region? @@regions[code] != nil end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/locale/info/region.rb', line 34 def to_s "#{code}" end |