Class: Fusuma::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/device.rb

Overview

detect input device

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.namesObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/fusuma/device.rb', line 7

def names
  return @names unless no_name?
  device_names = fetch_device_names
  MultiLogger.debug(device_names: device_names)
  raise 'Touchpad is not found' if device_names.empty?
  @names = device_names
rescue RuntimeError => ex
  MultiLogger.error(ex.message)
  exit 1
end

Class Method Details

.given_device=(name) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/fusuma/device.rb', line 19

def given_device=(name)
  return if name.nil?
  if names.include? name
    self.names = [name]
    return
  end
  MultiLogger.error("Device #{name} is not found")
  exit 1
end