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, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, 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



55
56
57
# File 'lib/faker/default/nation.rb', line 55

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



29
30
31
# File 'lib/faker/default/nation.rb', line 29

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



42
43
44
# File 'lib/faker/default/nation.rb', line 42

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



68
69
70
# File 'lib/faker/default/nation.rb', line 68

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