Class: Settlers::Collector
- Inherits:
-
Object
- Object
- Settlers::Collector
- Includes:
- Enumerable, Observer
- Defined in:
- lib/settlers/collector.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize ⇒ Collector
constructor
A new instance of Collector.
- #server_exists_at(address) ⇒ Object
- #size ⇒ Object
Methods included from Observer
Constructor Details
#initialize ⇒ Collector
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 |
#size ⇒ Object
20 21 22 |
# File 'lib/settlers/collector.rb', line 20 def size @addresses.size end |