Class: Decoder::Country
- Inherits:
-
Object
- Object
- Decoder::Country
- Includes:
- CommonMethods
- Defined in:
- lib/decoder/country.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #[](_code) ⇒ Object
-
#initialize(args) ⇒ Country
constructor
A new instance of Country.
- #states ⇒ Object (also: #counties, #provinces, #territories)
- #states=(_states) ⇒ Object
Methods included from CommonMethods
Constructor Details
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/decoder/country.rb', line 4 def code @code end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/decoder/country.rb', line 4 def name @name end |
Instance Method Details
#[](_code) ⇒ Object
24 25 26 27 28 |
# File 'lib/decoder/country.rb', line 24 def [](_code) _code = _code.to_s.upcase state = states[_code] Decoder::State.new(:code => _code, :name => state) end |
#states ⇒ Object Also known as: counties, provinces, territories
12 13 14 |
# File 'lib/decoder/country.rb', line 12 def states @states end |
#states=(_states) ⇒ Object
16 17 18 |
# File 'lib/decoder/country.rb', line 16 def states=(_states) @states = _states end |