Class: Tournament::Pool::StatsCollector
- Inherits:
-
Object
- Object
- Tournament::Pool::StatsCollector
- Includes:
- DRb::DRbUndumped
- Defined in:
- lib/tournament/pool.rb
Instance Method Summary collapse
- #count(child, count) ⇒ Object
- #count_of(child) ⇒ Object
-
#initialize ⇒ StatsCollector
constructor
A new instance of StatsCollector.
- #stats(child, stat) ⇒ Object
- #stats_of(child) ⇒ Object
- #total_count ⇒ Object
Constructor Details
#initialize ⇒ StatsCollector
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_count ⇒ Object
840 841 842 |
# File 'lib/tournament/pool.rb', line 840 def total_count @counts.values.inject(0) {|sum, count| sum += count} end |