Class: Faker::Sports::Chess

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

.federationString

Produces a long (alpha-3) ISO 3166 country code.

Examples:

Faker::Chess.federation #=> "COL"

Returns:

  • (String)

Available since:

  • next



29
30
31
# File 'lib/faker/sports/chess.rb', line 29

def federation
  Faker::Address.country_code_long
end

.openingString

Produces the name of a chess opening.

Examples:

Faker::Sports::Chess.opening #=> "Giuoco Piano"

Returns:

  • (String)

Available since:

  • next



71
72
73
# File 'lib/faker/sports/chess.rb', line 71

def opening
  fetch('chess.openings')
end

.playerString

Produces the name of a chess player name.

Examples:

Faker::Sports::Chess.player #=> "Golden State Warriors"

Returns:

  • (String)

Available since:

  • next



16
17
18
# File 'lib/faker/sports/chess.rb', line 16

def player
  fetch('chess.players')
end

.rating(from: 2000, to: 2900) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/faker/sports/chess.rb', line 46

def rating(from: 2000, to: 2900)
  ##
  # Produces a rating between two provided values. Boundaries are inclusive.
  #
  # @param from [Numeric] The lowest number to include.
  # @param to [Numeric] The highest number to include.
  # @return [Numeric]
  #
  # @example
  #   Faker::Sports::Chess.rating #=> 2734
  #   Faker::Sports::Chess.rating(from: 2400, to: 2700) #=> 2580
  #
  # @faker.version next
  Faker::Base.rand_in_range(from, to)
end

.titleString

Produces a chess title.

Examples:

Faker::Sports::Chess.title #=> "GM"

Returns:

  • (String)

Available since:

  • next



84
85
86
# File 'lib/faker/sports/chess.rb', line 84

def title
  fetch('chess.titles')
end

.tournamentObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/faker/sports/chess.rb', line 33

def tournament
  ##
  # Produces the name of a famous chess tournament name.
  #
  # @return [String]
  #
  # @example
  #   Faker::Chess.tournament #=> "Khanty-Mansisyk (Candidates Tournament)"
  #
  # @faker.version next
  fetch('chess.tournaments')
end