Class: CountryCodes::Country

Inherits:
Object
  • Object
show all
Includes:
Internal::Helpers
Defined in:
lib/country_codes/country.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Internal::Helpers

included, #pack_seq, #unpack_seq, #unpack_some

Constructor Details

#initialize(java_country) ⇒ Country

Note:

This code is not supposed to be used externally!

Wraps an instance of ‘io.wunderschild.country_codes.Country` to be used in Ruby.

Parameters:

  • java_country (JavaLangObject)

    An instance of ‘io.wunderschild.country_codes.Country`



25
26
27
# File 'lib/country_codes/country.rb', line 25

def initialize(java_country)
  @country = java_country
end

Instance Attribute Details

#alpha2String (readonly)

Returns ISO-3166-1 alpha-2 country code

Returns:

  • (String)

    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

#alpha3String (readonly)

Returns ISO-3166-1 alpha-3 country code

Returns:

  • (String)

    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

#nationalityString (readonly)

Returns a human-readable nationality name for this country

Returns:

  • (String)

    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_nameString (readonly)

Returns an official name of this country

Returns:

  • (String)

    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_namesArray<String> (readonly)

Returns an array of alternative names for this country

Returns:

  • (Array<String>)

    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

#sovereigntyString? (readonly)

Return country code for a country that this country is affiliated to (if any).

Returns:

  • (String, nil)

    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