Class: MetricDb::MetricBag
- Inherits:
-
Object
- Object
- MetricDb::MetricBag
show all
- Defined in:
- lib/MetricDb/MetricBag.rb
Instance Method Summary
collapse
Constructor Details
#initialize(list) ⇒ MetricBag
Returns a new instance of MetricBag.
5
6
7
|
# File 'lib/MetricDb/MetricBag.rb', line 5
def initialize( list )
@l = list
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methodName, *args) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/MetricDb/MetricBag.rb', line 27
def method_missing( methodName, *args )
answer = Array.new
@l.each do |metric|
answer << metric.send( methodName, args[0] )
end
return answer[0] if answer.length == 1
return answer
end
|
Instance Method Details
#get ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/MetricDb/MetricBag.rb', line 17
def get()
answer = Array.new
@l.each do |metric|
answer << metric.get()["value"]
end
return answer[0] if answer.length == 1
return answer
end
|
#push(value) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/MetricDb/MetricBag.rb', line 9
def push( value )
answer = Array.new
@l.each do |metric|
answer << metric.push(value)
end
return answer
end
|