class Faker::Sports::Chess

Public Class Methods

federation() click to toggle source

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

@return [String]

@example

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

@faker.version next

# File lib/faker/sports/chess.rb, line 29
def federation
  Faker::Address.country_code_long
end
opening() click to toggle source

Produces the name of a chess opening.

@return [String]

@example

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

@faker.version next

# File lib/faker/sports/chess.rb, line 71
def opening
  fetch('chess.openings')
end
player() click to toggle source

Produces the name of a chess player name.

@return [String]

@example

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

@faker.version next

# File lib/faker/sports/chess.rb, line 16
def player
  fetch('chess.players')
end
rating(from: 2000, to: 2900) click to toggle source
# 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
title() click to toggle source

Produces a chess title.

@return [String]

@example

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

@faker.version next

# File lib/faker/sports/chess.rb, line 84
def title
  fetch('chess.titles')
end
tournament() click to toggle source
# 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