Class: Steam::ServerList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/steam/server_list.rb

Overview

Represents a list of Servers we can connect to. There are a few defaults but an instance of this list should be updated as servers are sent down from Steam.

Examples:

Getting a random server

list = ServerList.new
list.sample # => Server

Instance Method Summary collapse

Constructor Details

#initializeServerList

TODO:

Add more servers

Instantiate a ServerList. Adds at least one Server object to the list



17
18
19
20
21
# File 'lib/steam/server_list.rb', line 17

def initialize
  @servers = [
    Server.new('208.78.164.12', 27_017)
  ]
end

Instance Method Details

#each(&block) ⇒ Object

Iterates over each Server in the list

Examples:

Iterating a server list

list = ServerList.new
list.each do |server|
  puts server.host
end


30
31
32
# File 'lib/steam/server_list.rb', line 30

def each(&block)
  @servers.each(&block)
end