lib/fusuma/plugin/sendkey/keyboard.rb in fusuma-plugin-sendkey-0.4.0 vs lib/fusuma/plugin/sendkey/keyboard.rb in fusuma-plugin-sendkey-0.5.0
- old
+ new
@@ -8,22 +8,21 @@
module Fusuma
module Plugin
module Sendkey
# Emulate Keyboard
class Keyboard
- def initialize(name_pattern: nil)
- name_pattern ||= 'keyboard'
+ def initialize(name_pattern: 'keyboard|Keyboard|KEYBOARD')
device = find_device(name_pattern: name_pattern)
if device.nil?
- warn "sendkey: Keyboard /#{name_pattern}/ is not found"
+ warn "sendkey: Keyboard: /#{name_pattern}/ is not found"
exit(1)
end
@device = Device.new(path: "/dev/input/#{device.id}")
end
- attr_writer :device
+ attr_reader :device
# @param param [String]
def type(param:)
return unless param.is_a?(String)