Included modules
Attributes
name | [RW] |
Public instance methods
+
(other)
[show source]
# File lib/benelux/stats.rb, line 66 66: def +(other) 67: unless @name == other.name 68: raise BeneluxError, "Cannot add #{other.name} to #{@name}" 69: end 70: g = Group.new self 71: g.name = @name 72: g << other 73: g 74: end
<<
(other)
[show source]
# File lib/benelux/stats.rb, line 76 76: def <<(other) 77: self.push *other 78: self 79: end
filter
(*tags)
[show source]
# File lib/benelux/stats.rb, line 116 116: def filter(*tags) 117: (f = super).name = @name 118: f 119: end
merge
(*tags)
[show source]
# File lib/benelux/stats.rb, line 81 81: def merge(*tags) 82: #tags = Selectable.normalize tags 83: mc = Calculator.new 84: mc.init_tags! 85: all = tags.empty? ? self : self.filter(tags) 86: all.each { |calc| 87: mc.merge! calc 88: mc.add_tags_quick calc.tags 89: } 90: mc 91: end
sample
(s, tags={})
[show source]
# File lib/benelux/stats.rb, line 93 93: def sample(s, tags={}) 94: raise BeneluxError, "tags must be a Hash" unless Hash === tags 95: c = Calculator.new 96: c.add_tags tags 97: c.sample s 98: self << c 99: nil 100: end
tag_values
(tag)
[show source]
# File lib/benelux/stats.rb, line 102 102: def tag_values(tag) 103: vals = self.collect { |calc| calc.tags[tag] } 104: Array.new vals.uniq 105: end