class TouchscreenTaps::TouchscreenDevice

represents a physical input device (e.g touchscreen)

Constants

REQUIRED_CAPABILITY

Attributes

kernel[R]

Public Class Methods

new(kernel) click to toggle source
# File lib/touchscreen_taps/touchscreen_device.rb, line 9
def initialize(kernel)
  @kernel = kernel
end
select_from(devices) click to toggle source
# File lib/touchscreen_taps/touchscreen_device.rb, line 14
def select_from(devices)
  devices.map do |device|
    next unless capable?(device)

    kernel = kernel_path(device)
    new(kernel) unless kernel.nil?
  end.compact
end

Private Class Methods

capable?(device) click to toggle source
# File lib/touchscreen_taps/touchscreen_device.rb, line 25
def capable?(device)
  device.find { |f| f =~ /^Capabilities:/ }
        .include?(REQUIRED_CAPABILITY)
end
kernel_path(device) click to toggle source
# File lib/touchscreen_taps/touchscreen_device.rb, line 30
def kernel_path(device)
  device.find { |f| f =~ /^Kernel:/ }.split(' ').last
end