A Calculator subclass which adds support for a hash of per-user Calculator instances accessed via user ID, as a string.
# File lib/track_record_report.rb, line 122 def initialize super() @user_totals = {} end
Return a Calculator object for the given user (as a string database ID), or nil if there is no such user record for this cell.
# File lib/track_record_report.rb, line 130 def user_total( user_id_str ) @user_totals[ user_id_str ] end
Return a Calculator object for the given user (as a string database ID), lazy-creating a new instance if need be.
# File lib/track_record_report.rb, line 137 def user_total!( user_id_str ) @user_totals[ user_id_str ] ||= Calculator.new end