Class: Stats::Sum
Instance Method Summary collapse
- #add(d) ⇒ Object
- #get_value ⇒ Object
-
#initialize(d) ⇒ Sum
constructor
A new instance of Sum.
- #merge(stat) ⇒ Object
- #remove(d) ⇒ Object
Methods inherited from StatsType
Constructor Details
#initialize(d) ⇒ Sum
Returns a new instance of Sum.
24 25 26 |
# File 'lib/shades/stats.rb', line 24 def initialize(d) @val = d end |
Instance Method Details
#add(d) ⇒ Object
28 29 30 |
# File 'lib/shades/stats.rb', line 28 def add(d) @val += d end |
#get_value ⇒ Object
40 41 42 |
# File 'lib/shades/stats.rb', line 40 def get_value @val end |
#merge(stat) ⇒ Object
36 37 38 |
# File 'lib/shades/stats.rb', line 36 def merge(stat) @val += stat.get_value end |
#remove(d) ⇒ Object
32 33 34 |
# File 'lib/shades/stats.rb', line 32 def remove(d) @val -= d end |