class Nucleo::Models::MetricPeriodsComparison
Public Class Methods
new(attributes={})
click to toggle source
Creates a new instance of the Metric
Periods Comparison domain model.
@param attributes [Hash]
@return [Nucleo::Models::MetricPeriodsComparison]
# File lib/nucleo/models/metric_periods_comparison.rb, line 13 def initialize(attributes={}) @attributes = attributes end
Public Instance Methods
change()
click to toggle source
Returns the percent change
@return [Integer]
# File lib/nucleo/models/metric_periods_comparison.rb, line 41 def change @attributes['change'].to_f end
current_value()
click to toggle source
Returns the current period value
@return [Float]
# File lib/nucleo/models/metric_periods_comparison.rb, line 27 def current_value @attributes['current_value'].to_f end
dimension()
click to toggle source
Returns the dimension
@return [String]
# File lib/nucleo/models/metric_periods_comparison.rb, line 20 def dimension @attributes['dimension'] end
direction()
click to toggle source
Returns the direcction of change
@return [String]
# File lib/nucleo/models/metric_periods_comparison.rb, line 69 def direction if self.positive_change? 'up' elsif self.no_change? 'same' elsif self.negative_change? 'down' end end
negative_change?()
click to toggle source
Returns true if the change is negative
@return [Boolean]
# File lib/nucleo/models/metric_periods_comparison.rb, line 62 def negative_change? self.change < 0 end
no_change?()
click to toggle source
Returns true if there is no change
@return [Boolean]
# File lib/nucleo/models/metric_periods_comparison.rb, line 48 def no_change? self.change == 0 end
positive_change?()
click to toggle source
Returns true if there is a positive change
@return [Boolean]
# File lib/nucleo/models/metric_periods_comparison.rb, line 55 def positive_change? self.change > 0 end
prior_value()
click to toggle source
Returns the prior period value
@return [Float]
# File lib/nucleo/models/metric_periods_comparison.rb, line 34 def prior_value @attributes['prior_value'].to_f end