Class: Stat::Count::Data::CountResult
- Inherits:
-
Object
- Object
- Stat::Count::Data::CountResult
- Defined in:
- lib/stat-count-client/stat_count_data.rb
Instance Attribute Summary collapse
-
#countResults ⇒ Object
Returns the value of attribute countResults.
Instance Method Summary collapse
- #getResult(name = nil, id = nil) ⇒ Object
-
#initialize(hash) ⇒ CountResult
constructor
A new instance of CountResult.
Constructor Details
#initialize(hash) ⇒ CountResult
Returns a new instance of CountResult.
108 109 110 |
# File 'lib/stat-count-client/stat_count_data.rb', line 108 def initialize(hash) @countResults = hash['countResults'] end |
Instance Attribute Details
#countResults ⇒ Object
Returns the value of attribute countResults.
106 107 108 |
# File 'lib/stat-count-client/stat_count_data.rb', line 106 def countResults @countResults end |
Instance Method Details
#getResult(name = nil, id = nil) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/stat-count-client/stat_count_data.rb', line 112 def getResult(name=nil, id=nil) if(name.nil?) return @countResults end countHash = @countResults[name] if(countHash.nil?) raise ArgumentError,"服务的名称: " + name + " 不存在!" end if (id.nil?) return countHash end count = countHash[id] if(count.nil?) raise ArgumentError,"业务ID: "+id +" 不存在" end count end |