Sha256: 7378e5f2bef3c0b7e9d9600cfce41944f9201aa8b0e612f9191506dd12fbe3cc

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module Starcall
  # This class is used to list and validate regions.
  class Regions
    # A list of valid Riot Regions.
    def self.list
      [
        'br',   # Brazil
        'eune', # EU North East
        'euw',  # EU West
        'lan',  # Latin America North
        'las',  # Latin America South
        'na',   # North America
        'oce',  # Oceania
        'ru',   # Russia
        'tr',   # Turkey
        'jp',   # Japan
        'kr'    # Korea
      ]
    end

    # A method to check is the region is valid, if not, raise an error.
    def self.valid?(region:)
      return true if list.include? region

      raise Starcall::Errors::InvalidRegion.new(region: region)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
starcall-0.6.0 lib/starcall/regions.rb
starcall-0.5.0 lib/starcall/regions.rb
starcall-0.4.0 lib/starcall/regions.rb
starcall-0.3.0 lib/starcall/regions.rb