forked from faker-ruby/faker
/
nation.rb
76 lines (70 loc) · 1.53 KB
/
nation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# frozen_string_literal: true
module Faker
class Nation < Base
flexible :nation
class << self
##
# Produces a random nationality.
#
# @return [String]
#
# @example
# Faker::Nation.nationality #=> "Nepalese"
#
# @faker.version 1.9.0
def nationality
fetch('nation.nationality')
end
# rubocop:disable Style/AsciiComments
##
# Produces a random national flag emoji.
#
# @return [String]
#
# @example
# Faker::Nation.flag #=> "🇫🇮"
#
# @faker.version 1.9.0
def flag
sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
end
# rubocop:enable Style/AsciiComments
##
# Produces a random national language.
#
# @return [String]
#
# @example
# Faker::Nation.language #=> "Nepali"
#
# @faker.version 1.9.0
def language
fetch('nation.language')
end
##
# Produces a random capital city.
#
# @return [String]
#
# @example
# Faker::Nation.capital_city #=> "Kathmandu"
#
# @faker.version 1.9.0
def capital_city
fetch('nation.capital_city')
end
##
# Produces a random national sport.
#
# @return [String]
#
# @example
# Faker::Nation.national_sport #=> "dandi biyo"
#
# @faker.version 1.9.0
def national_sport
fetch('team.sport')
end
end
end
end