Class: Faker::WorldCup

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/world_cup.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

.cityString

Produces a city name hosting the World Cup match.

Examples:

Faker::WorldCup.city #=> "Moscow"

Returns:

  • (String)

Available since:

  • 2.13.0


28
29
30
# File 'lib/faker/default/world_cup.rb', line 28

def city
  fetch('world_cup.cities')
end

.group(legacy_group = NOT_GIVEN, group: 'group_A') ⇒ String

Produces a random national team name from a group.

Examples:

Faker::WorldCup.group(group: 'group_B') #=> "Spain"
Faker::WorldCup.group #=> "Russia"

Returns:

  • (String)

Available since:

  • 2.13.0


56
57
58
59
60
61
62
# File 'lib/faker/default/world_cup.rb', line 56

def group(legacy_group = NOT_GIVEN, group: 'group_A')
  warn_for_deprecated_arguments do |keywords|
    keywords << :group if legacy_group != NOT_GIVEN
  end

  fetch("world_cup.groups.#{group}")
end

.roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach') ⇒ String

Produces a random name from national team roster.

Examples:

Faker::WorldCup.roster #=> "Hector Cuper"
Faker::WorldCup.roster(country: 'Spain', type: 'forwards') #=> "Diego Costa"

Returns:

  • (String)

Available since:

  • 2.13.0


76
77
78
79
80
81
82
83
# File 'lib/faker/default/world_cup.rb', line 76

def roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach')
  warn_for_deprecated_arguments do |keywords|
    keywords << :country if legacy_country != NOT_GIVEN
    keywords << :type if legacy_type != NOT_GIVEN
  end

  fetch("world_cup.rosters.#{country}.#{type}")
end

.stadiumString

Produces the name of a stadium that has hosted a World Cup match.

Examples:

Faker::WorldCup.stadium #=> "Rostov Arena"

Returns:

  • (String)

Available since:

  • 2.13.0


41
42
43
# File 'lib/faker/default/world_cup.rb', line 41

def stadium
  fetch('world_cup.stadiums')
end

.teamString

Produces a national team name.

Examples:

Faker::WorldCup.team #=> "Iran"

Returns:

  • (String)

Available since:

  • 1.9.0


15
16
17
# File 'lib/faker/default/world_cup.rb', line 15

def team
  fetch('world_cup.teams')
end