lib/fusuma/plugin/parsers/keypress_parser.rb in fusuma-plugin-keypress-0.5.0 vs lib/fusuma/plugin/parsers/keypress_parser.rb in fusuma-plugin-keypress-0.6.1
- old
+ new
@@ -3,11 +3,11 @@
module Fusuma
module Plugin
module Parsers
# Generate KeypressRecord from libinput_command_input
class KeypressParser < Parser
- DEFAULT_SOURCE = 'libinput_command_input'
+ DEFAULT_SOURCE = "libinput_command_input"
# @param record [String]
# @return [Records::Gesture, nil]
def parse_record(record)
line = record.to_s
@@ -22,18 +22,18 @@
case line
when /KEYBOARD_KEY.+(\d+\.\d+)s.*KEY_([A-Z]+).*(pressed|released)/
matched = Regexp.last_match
# time = matched[1] # 4.81
- code = matched[2] # LEFTSHIFT
+ code = matched[2] # LEFTSHIFT
status = matched[3] # pressed
Events::Records::KeypressRecord.new(status: status, code: code)
end
end
def tag
- 'keypress_parser'
+ "keypress_parser"
end
end
end
end
end