Sha256: 79506399cde391295f480a20226e4709b826f72de70fa9607bf89edfb52d5c3a

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

module WeatherLink
  class SensorDataCollection < SimpleDelegator
    attr_reader :client

    def initialize(client, sensors)
      @client = client
      super(sensors)
    end

    def to_s
      "#<#{self.class.name} (#{size} sensors)>"
    end

    def inspect
      to_s
    end

    def current_conditions
      SensorDataCollection.new(client, select(&:current_conditions?))
    end

    def archive
      SensorDataCollection.new(client, select(&:archive?))
    end

    def weather
      SensorDataCollection.new(client, select(&:weather?))
    end

    def health
      SensorDataCollection.new(client, select(&:health?))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weatherlink-0.1.0 lib/weatherlink/sensor_data_collection.rb