Class: SplitBuilder::Metric
- Inherits:
-
Object
- Object
- SplitBuilder::Metric
- Defined in:
- lib/builder/metric.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #goals ⇒ Object
-
#initialize(metric_name, &block) ⇒ Metric
constructor
A new instance of Metric.
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
#name ⇒ Object (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
#goals ⇒ Object
16 17 18 |
# File 'lib/builder/metric.rb', line 16 def goals @goals ||= [] end |