Class: Faker::Nation

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/nation.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.capital_cityString

Produces a random capital city.

Examples:

Faker::Nation.capital_city #=> "Kathmandu"

Returns:

  • (String)

Available since:

  • 1.9.0


58
59
60
# File 'lib/faker/default/nation.rb', line 58

def capital_city
  fetch('nation.capital_city')
end

.flagString

Produces a random national flag emoji.

Examples:

Faker::Nation.flag #=> "🇫🇮"

Returns:

  • (String)

Available since:

  • 1.9.0


31
32
33
# File 'lib/faker/default/nation.rb', line 31

def flag
  sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
end

.languageString

Produces a random national language.

Examples:

Faker::Nation.language #=> "Nepali"

Returns:

  • (String)

Available since:

  • 1.9.0


45
46
47
# File 'lib/faker/default/nation.rb', line 45

def language
  fetch('nation.language')
end

.national_sportString

Produces a random national sport.

Examples:

Faker::Nation.national_sport #=> "dandi biyo"

Returns:

  • (String)

Available since:

  • 1.9.0


71
72
73
# File 'lib/faker/default/nation.rb', line 71

def national_sport
  fetch('team.sport')
end

.nationalityString

Produces a random nationality.

Examples:

Faker::Nation.nationality #=> "Nepalese"

Returns:

  • (String)

Available since:

  • 1.9.0


16
17
18
# File 'lib/faker/default/nation.rb', line 16

def nationality
  fetch('nation.nationality')
end