Class: Nucleo::Models::Metric
- Inherits:
-
Object
- Object
- Nucleo::Models::Metric
- Defined in:
- lib/nucleo/models/metric.rb
Instance Method Summary collapse
-
#classification ⇒ String
Returns the classification of the metric.
-
#dimension ⇒ String
Returns the dimension.
-
#initialize(attributes = {}) ⇒ Nucleo::Models::Metric
constructor
Returns an instance of the Metric domain model.
-
#metric ⇒ String
Returns the type of the metric.
-
#metric_periods ⇒ Nucleo::Models::MetricPeriods
Returns the metric periods used for comparison.
Constructor Details
#initialize(attributes = {}) ⇒ Nucleo::Models::Metric
Returns an instance of the Metric domain model. This is the core domain model for a specific metric ‘type` and `classification`.
13 14 15 |
# File 'lib/nucleo/models/metric.rb', line 13 def initialize(attributes={}) @attributes = attributes end |
Instance Method Details
#classification ⇒ String
Returns the classification of the metric
20 21 22 |
# File 'lib/nucleo/models/metric.rb', line 20 def classification @attributes['classification'] end |
#dimension ⇒ String
Returns the dimension
34 35 36 |
# File 'lib/nucleo/models/metric.rb', line 34 def dimension @attributes['dimension'] end |
#metric ⇒ String
Returns the type of the metric
27 28 29 |
# File 'lib/nucleo/models/metric.rb', line 27 def metric @attributes['metric'] end |
#metric_periods ⇒ Nucleo::Models::MetricPeriods
Returns the metric periods used for comparison
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nucleo/models/metric.rb', line 41 def metric_periods params = { 'metric' => self.metric, 'dimension' => self.dimension, 'totals' => @attributes['totals'], 'current_period' => @attributes['current_period'], 'prior_period' => @attributes['prior_period'] } Nucleo::Models::MetricPeriods.new(params) end |