Class: Expri::MetricSet

Inherits:
Object
  • Object
show all
Defined in:
lib/expri/metric_set.rb

Instance Method Summary collapse

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={})
  @options = { :destroy_extras => true }.merge(options)
end

Instance Method Details

#metric(name, attributes = {}, options = {}) ⇒ Object



3
4
5
# File 'lib/expri/metric_set.rb', line 3

def metric(name, attributes={}, options={})
  @metrics << Metric.new(name, attributes, @options.merge(options))
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