Class: GetKeysInteractor

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

Instance Method Summary collapse

Methods included from Log

#logger, verbose

Constructor Details

#initialize(stf) ⇒ GetKeysInteractor

Returns a new instance of GetKeysInteractor.



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

def initialize(stf)
  @stf = stf
end

Instance Method Details

#executeObject



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

def execute
  devices = @stf.get_devices

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

  return devices
           .map {|d| Device.new(d)}
           .flat_map {|d| d.getKeys }
           .uniq
           .sort
end