Sha256: 9de9e250b7a76731ffb33ada25e2aaa90ba000bf8d20c588b4339e17fff0128e

Contents?: true

Size: 487 Bytes

Versions: 2

Compression:

Stored size: 487 Bytes

Contents

class DhtStub
  class NullLogger
    def debug(*) end
  end

  # Note: #type and #pin are not yet available on the dth_sensor class
  attr_reader :type, :pin

  def initialize(type, pin, logger: NullLogger.new)
    @type = type
    logger.debug "DHT Type --> #{type}"

    @pin = pin
    logger.debug "DHT Pin  --> #{pin}"

    @temperature = 42.0
    @humidity = 69.0

    self
  end

  def to_a
    [@temperature, @humidity]
  end

  private

  attr_writer :humidity, :temperature
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dht_sensor-0.0.2 lib/dht_sensor/dht_stub.rb
dht_sensor-0.0.1 lib/dht_sensor/dht_stub.rb