Sha256: 920098db4d354ddf7e137de83df035aad4faeb044c13a998e2050ca754cf648a

Contents?: true

Size: 369 Bytes

Versions: 8

Compression:

Stored size: 369 Bytes

Contents

require "active_support/core_ext"

require "flex_station_data/concerns/service"

module FlexStationData
  class ComputeMean
    include Concerns::Service

    attr_reader :values

    def initialize(values)
      @values = values
    end

    def call
      Float(values.sum) / values.size
    rescue ArgumentError, TypeError, NoMethodError
      nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flex-station-data-1.0.1 lib/flex_station_data/services/compute_mean.rb
flex-station-data-1.0.0 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.3.2 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.3.1 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.3.0 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.2.0 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.1.1 lib/flex_station_data/services/compute_mean.rb
flex-station-data-0.1.0 lib/flex_station_data/services/compute_mean.rb