Class: CountryCodes::Country
- Inherits:
-
Object
- Object
- CountryCodes::Country
- Includes:
- Internal::Helpers
- Defined in:
- lib/country_codes/country.rb
Instance Attribute Summary collapse
-
#alpha2 ⇒ String
readonly
Returns ISO-3166-1 alpha-2 country code.
-
#alpha3 ⇒ String
readonly
Returns ISO-3166-1 alpha-3 country code.
-
#nationality ⇒ String
readonly
Returns a human-readable nationality name for this country.
-
#official_name ⇒ String
readonly
Returns an official name of this country.
-
#other_names ⇒ Array<String>
readonly
Returns an array of alternative names for this country.
-
#sovereignty ⇒ String?
readonly
Return country code for a country that this country is affiliated to (if any).
Instance Method Summary collapse
-
#initialize(java_country) ⇒ Country
constructor
Wraps an instance of ‘io.wunderschild.country_codes.Country` to be used in Ruby.
Methods included from Internal::Helpers
included, #pack_seq, #unpack_seq, #unpack_some
Constructor Details
#initialize(java_country) ⇒ Country
This code is not supposed to be used externally!
Wraps an instance of ‘io.wunderschild.country_codes.Country` to be used in Ruby.
25 26 27 |
# File 'lib/country_codes/country.rb', line 25 def initialize(java_country) @country = java_country end |
Instance Attribute Details
#alpha2 ⇒ String (readonly)
Returns ISO-3166-1 alpha-2 country code
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |
#alpha3 ⇒ String (readonly)
Returns ISO-3166-1 alpha-3 country code
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |
#nationality ⇒ String (readonly)
Returns a human-readable nationality name for this country
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |
#official_name ⇒ String (readonly)
Returns an official name of this country
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |
#other_names ⇒ Array<String> (readonly)
Returns an array of alternative names for this country
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |
#sovereignty ⇒ String? (readonly)
Return country code for a country that this country is affiliated to (if any).
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/country_codes/country.rb', line 18 class Country include Internal::Helpers # Wraps an instance of `io.wunderschild.country_codes.Country` to be used in Ruby. # # @note This code is not supposed to be used externally! # @param [JavaLangObject] java_country An instance of `io.wunderschild.country_codes.Country` def initialize(java_country) @country = java_country end delegate :alpha2, :alpha3, :official_name, to: :country delegate :nationality, :sovereignty, to: :country, interceptors: :unpack_some delegate :other_names, to: :country, interceptors: %i[unpack_some unpack_seq array_no_nil] private attr_reader :country def array_no_nil(array) array.nil? ? [] : array end end |