Class: GetValuesInteractor

Inherits:
Object
  • Object
show all
Includes:
ADB, Log
Defined in:
lib/stf/interactor/get_values_interactor.rb

Instance Method Summary collapse

Methods included from Log

#logger, verbose

Constructor Details

#initialize(stf) ⇒ GetValuesInteractor

Returns a new instance of GetValuesInteractor.



14
15
16
# File 'lib/stf/interactor/get_values_interactor.rb', line 14

def initialize(stf)
  @stf = stf
end

Instance Method Details

#execute(key) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/stf/interactor/get_values_interactor.rb', line 18

def execute(key)
  devices = @stf.get_devices

  if devices.nil? || (devices.is_a?(Array) && devices.empty?)
    logger.info r 'No devices connected to STF'
    return []
  end

  return devices
           .map {|d| Device.new(d)}
           .map {|d| d.getValue(key)}
           .uniq
end