Class: Stat::Count::Data::SimpleCount
- Inherits:
-
Object
- Object
- Stat::Count::Data::SimpleCount
- Defined in:
- lib/stat-count-client/stat_count_data.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#counts ⇒ Object
Returns the value of attribute counts.
Instance Method Summary collapse
- #addCount(name, id, count = 1, countUnit = nil) ⇒ Object
- #getCounts ⇒ Object
- #getCountsSize ⇒ Object
-
#initialize ⇒ SimpleCount
constructor
A new instance of SimpleCount.
Constructor Details
#initialize ⇒ SimpleCount
Returns a new instance of SimpleCount.
26 27 28 |
# File 'lib/stat-count-client/stat_count_data.rb', line 26 def initialize @counts = Hash.new end |
Instance Attribute Details
#counts ⇒ Object
Returns the value of attribute counts.
24 25 26 |
# File 'lib/stat-count-client/stat_count_data.rb', line 24 def counts @counts end |
Instance Method Details
#addCount(name, id, count = 1, countUnit = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/stat-count-client/stat_count_data.rb', line 30 def addCount(name, id, count=1, countUnit=nil) countUnitList = @counts[name] if (countUnitList.nil?) countUnitList = Array.new @counts[name] = countUnitList end if (countUnit.nil?) countUnit = CountUnit.new end countUnit.id = id countUnit.count = count countUnitList << countUnit self end |
#getCounts ⇒ Object
46 47 48 |
# File 'lib/stat-count-client/stat_count_data.rb', line 46 def getCounts @counts end |
#getCountsSize ⇒ Object
50 51 52 |
# File 'lib/stat-count-client/stat_count_data.rb', line 50 def getCountsSize @counts.length end |