Sha256: 31d1c7e3352145aa0859d2cc5d4aada3899763244ca16da8ea79928e317cb15f

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

require "flex_station_data/services/value_quality"

module FlexStationData
  class SampleQuality
    include Concerns::Service

    attr_reader :sample, :value_quality_control, :options

    def initialize(sample, value_quality_control: ValueQuality, **options)
      @sample = sample
      @value_quality_control = value_quality_control
      @options = options
    end

    def value_quality(value)
      value_quality_control.call(value, **options)
    end

    def call
      sample.readings.flat_map(&:values).map(&method(:value_quality)).uniq(&:to_s)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flex-station-data-0.3.1 lib/flex_station_data/services/sample_quality.rb
flex-station-data-0.3.0 lib/flex_station_data/services/sample_quality.rb