Class: FlexStationData::ComputeMean
- Inherits:
-
Object
- Object
- FlexStationData::ComputeMean
- Includes:
- Callable
- Defined in:
- lib/flex_station_data/services/compute_mean.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(values) ⇒ ComputeMean
constructor
A new instance of ComputeMean.
Constructor Details
#initialize(values) ⇒ ComputeMean
Returns a new instance of ComputeMean.
13 14 15 |
# File 'lib/flex_station_data/services/compute_mean.rb', line 13 def initialize(values) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
11 12 13 |
# File 'lib/flex_station_data/services/compute_mean.rb', line 11 def values @values end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'lib/flex_station_data/services/compute_mean.rb', line 17 def call Float(values.sum) / values.size rescue ArgumentError, TypeError, NoMethodError nil end |