Class: Settlers::Collector

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Observer
Defined in:
lib/settlers/collector.rb

Instance Method Summary collapse

Methods included from Observer

#update

Constructor Details

#initializeCollector

Returns a new instance of Collector.



8
9
10
# File 'lib/settlers/collector.rb', line 8

def initialize
  @addresses = Set.new
end

Instance Method Details

#each(&block) ⇒ Object



16
17
18
# File 'lib/settlers/collector.rb', line 16

def each(&block)
  @addresses.sort.each(&block)
end

#server_exists_at(address) ⇒ Object



12
13
14
# File 'lib/settlers/collector.rb', line 12

def server_exists_at(address)
  @addresses.add(address)
end

#sizeObject



20
21
22
# File 'lib/settlers/collector.rb', line 20

def size
  @addresses.size
end