Class: Tournament::Pool::StatsCollector

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/tournament/pool.rb

Instance Method Summary collapse

Constructor Details

#initializeStatsCollector

Returns a new instance of StatsCollector.



824
825
826
827
# File 'lib/tournament/pool.rb', line 824

def initialize
  @counts = {}
  @stats = {}
end

Instance Method Details

#count(child, count) ⇒ Object



828
829
830
# File 'lib/tournament/pool.rb', line 828

def count(child, count)
  @counts[child] = count
end

#count_of(child) ⇒ Object



837
838
839
# File 'lib/tournament/pool.rb', line 837

def count_of(child)
  @count[child]
end

#stats(child, stat) ⇒ Object



831
832
833
# File 'lib/tournament/pool.rb', line 831

def stats(child, stat)
  @stats[child] = stat
end

#stats_of(child) ⇒ Object



834
835
836
# File 'lib/tournament/pool.rb', line 834

def stats_of(child)
  @stats[child]
end

#total_countObject



840
841
842
# File 'lib/tournament/pool.rb', line 840

def total_count
  @counts.values.inject(0) {|sum, count| sum += count}
end