Class: SplitBuilder::Metric

Inherits:
Object
  • Object
show all
Defined in:
lib/builder/metric.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_name, &block) ⇒ Metric

Returns a new instance of Metric.



10
11
12
13
14
# File 'lib/builder/metric.rb', line 10

def initialize(metric_name, &block)
  @name = metric_name
  instance_exec(&block) if block_given?
  goal(metric_name) if goals.empty?
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/builder/metric.rb', line 8

def name
  @name
end

Class Method Details

.define(metric_name, &block) ⇒ Object



4
5
6
# File 'lib/builder/metric.rb', line 4

def self.define(metric_name, &block)
  new(metric_name, &block)
end

Instance Method Details

#goalsObject



16
17
18
# File 'lib/builder/metric.rb', line 16

def goals
  @goals ||= []
end