Class: Fusuma::Plugin::Sendkey::Device
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Sendkey::Device
- Defined in:
- lib/fusuma/plugin/sendkey/device.rb
Overview
handle Evdev device
Instance Method Summary collapse
-
#initialize(path:) ⇒ Device
constructor
A new instance of Device.
- #path ⇒ Object
- #write_event(event) ⇒ Object
Constructor Details
#initialize(path:) ⇒ Device
Returns a new instance of Device.
8 9 10 |
# File 'lib/fusuma/plugin/sendkey/device.rb', line 8 def initialize(path:) @evdev = Revdev::EventDevice.new(path) end |
Instance Method Details
#path ⇒ Object
12 13 14 15 16 |
# File 'lib/fusuma/plugin/sendkey/device.rb', line 12 def path raise "Device path is not found" if @evdev.nil? @path ||= @evdev.file.path end |
#write_event(event) ⇒ Object
18 19 20 |
# File 'lib/fusuma/plugin/sendkey/device.rb', line 18 def write_event(event) @evdev.write_input_event(event) end |