Class: DhtStub

Inherits:
Object
  • Object
show all
Defined in:
lib/dht_sensor/dht_stub.rb

Defined Under Namespace

Classes: NullLogger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, pin, logger: NullLogger.new) ⇒ DhtStub



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/dht_sensor/dht_stub.rb', line 9

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

Instance Attribute Details

#pinObject (readonly)

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



7
8
9
# File 'lib/dht_sensor/dht_stub.rb', line 7

def pin
  @pin
end

#typeObject (readonly)

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



7
8
9
# File 'lib/dht_sensor/dht_stub.rb', line 7

def type
  @type
end

Instance Method Details

#to_aObject



22
23
24
# File 'lib/dht_sensor/dht_stub.rb', line 22

def to_a
  [@temperature, @humidity]
end