From 4a210c398dd9b39ab25e1896743086b1f6a204c3 Mon Sep 17 00:00:00 2001 From: iberianpig Date: Sat, 20 Jan 2024 09:10:01 +0900 Subject: [PATCH] feat: add layer to keypress record - add attr_reader :layer - this field will be used from other plugin like `thumbsense` --- lib/fusuma/plugin/events/records/keypress_record.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/fusuma/plugin/events/records/keypress_record.rb b/lib/fusuma/plugin/events/records/keypress_record.rb index 49f95e2..74aad7e 100644 --- a/lib/fusuma/plugin/events/records/keypress_record.rb +++ b/lib/fusuma/plugin/events/records/keypress_record.rb @@ -6,13 +6,14 @@ module Events module Records # Record for Keypress event class KeypressRecord < Record - attr_reader :status, :code + attr_reader :status, :code, :layer # @example - # KeypressRecord.new(status: 'pressed', code: 'LEFTSHIFT') + # KeypressRecord.new(status: 'pressed', code: 'LEFTSHIFT', layer: 'thumbsense') # - # @param status [String] + # @param status [String] 'pressed' or 'released' # @param code [String] + # @param layer [Hash] this field will be used from other plugin. def initialize(status:, code:, layer: nil) super() @status = status @@ -21,7 +22,7 @@ def initialize(status:, code:, layer: nil) end def to_s - "#{status} #{code}" + "#{status} #{code} #{layer}" end end end