Class: Expri::MetricSet
- Inherits:
-
Object
- Object
- Expri::MetricSet
- Defined in:
- lib/expri/metric_set.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MetricSet
constructor
A new instance of MetricSet.
- #metric(name, attributes = {}, options = {}) ⇒ Object
- #run(&block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ MetricSet
Returns a new instance of MetricSet.
7 8 9 |
# File 'lib/expri/metric_set.rb', line 7 def initialize(={}) @options = { :destroy_extras => true }.merge() end |
Instance Method Details
#metric(name, attributes = {}, options = {}) ⇒ Object
3 4 5 |
# File 'lib/expri/metric_set.rb', line 3 def metric(name, attributes={}, ={}) @metrics << Metric.new(name, attributes, @options.merge()) end |
#run(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/expri/metric_set.rb', line 11 def run(&block) puts "run options=#{@options}" if @options[:verbose] cache_current @metrics = [] instance_eval(&block) @metrics.each do |metric| metric.put end destroy_extras end |