fusuma 3.11.0 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55410ba5fd5d7543fe4089aa09f2af2229400d49be8d9572f1e6d41af79b1079
4
- data.tar.gz: fcf73fd3254b1f9ba58cf61ba5705bbbd76d8448e91a2d12a12fc08116325367
3
+ metadata.gz: '064986ef807ceb1aa5ce1d021cdaf8931e44a1099fe8b72cd6aee283bc7ccf3a'
4
+ data.tar.gz: 31d80cdd2c54c1f12a4e55005c4393ae4c3683ed0a0c3a4e506090cc2c0f4f73
5
5
  SHA512:
6
- metadata.gz: fac06a520334b1ff98e9467f06633e801c2bd86e56860232c54bfd0a36df2cec77bc8fa1f97a8ceafbb6561221fb5ea9bd4766e58e37b780c9ba450a8ec2fdd2
7
- data.tar.gz: 28098f90c6aadef6f44f4f0cc6c3e8244e9921f9e70a1dc18293f9374d1e4d3a7c0d340458e2d758bfa9a5fb0e8c2fa124170f40e8c4b3fee03de142ed1c7196
6
+ metadata.gz: f27789347f194611db15b63f8cd8f04c47e3737ad2349950ab2a9210612f76a96f166c50a136bd2e4e22cce8dd9e640f89a7f8be19f2c282b4a071650cc26af1
7
+ data.tar.gz: 86d0e0bac6c527e7453f4495bde1e58b4b74942b3670ee313d1a7f0323c7a4f9e5ed44c33f64614357ff8b38bbf9e265e074abbd6ce5915925233e3c7f3adc01
data/lib/fusuma/device.rb CHANGED
@@ -41,9 +41,7 @@ module Fusuma
41
41
  def all
42
42
  @all ||= fetch_devices.partition do |d|
43
43
  d.capabilities.match?(/gesture/)
44
- end.flatten.tap do |devices|
45
- log_if_changed(devices)
46
- end
44
+ end.flatten
47
45
  end
48
46
 
49
47
  # @return [Array]
@@ -59,22 +57,10 @@ module Fusuma
59
57
  def reset
60
58
  @all = nil
61
59
  @available = nil
62
- @previous_device_ids = nil
63
60
  end
64
61
 
65
62
  private
66
63
 
67
- # Log device list only when it changes
68
- # @param devices [Array<Device>]
69
- #: (Array[Device]) -> void
70
- def log_if_changed(devices)
71
- device_ids = devices.map(&:id).sort
72
- return if @previous_device_ids == device_ids
73
-
74
- MultiLogger.debug(detected_devices: devices.map { |d| {id: d.id, name: d.name} })
75
- @previous_device_ids = device_ids
76
- end
77
-
78
64
  # @return [Array]
79
65
  #: () -> Array[Device]
80
66
  def fetch_devices
@@ -8,8 +8,8 @@ module Fusuma
8
8
  module Plugin
9
9
  # Create a Plugin Class with extending this class
10
10
  class Base
11
- # when inherited from subclass
12
- #: (Class) -> Array[untyped]
11
+ # Callback when a subclass inherits from this class.
12
+ # Registers the subclass with the plugin manager.
13
13
  def self.inherited(subclass)
14
14
  super
15
15
 
@@ -18,7 +18,11 @@ module Fusuma
18
18
  raise "Plugin class #{subclass.name} must be defined in a file."
19
19
  end
20
20
 
21
- subclass_path = locations.first.path
21
+ subclass_path = locations.first&.path
22
+ if subclass_path.nil?
23
+ raise "Plugin class #{subclass.name} must have a valid file path."
24
+ end
25
+
22
26
  Manager.add(plugin_class: subclass, plugin_path: subclass_path)
23
27
  end
24
28
 
@@ -29,13 +33,12 @@ module Fusuma
29
33
  end
30
34
 
31
35
  # @abstract override `#shutdown` to implement
32
- #: () -> nil
36
+ #: () -> void
33
37
  def shutdown
34
38
  end
35
39
 
36
40
  # config parameter name and Type of the value of parameter
37
41
  # @return [Hash]
38
- #: () -> Hash[Symbol, Array[Class] | Class]
39
42
  def config_param_types
40
43
  raise NotImplementedError, "override #{self.class.name}##{__method__}"
41
44
  end
@@ -43,7 +46,8 @@ module Fusuma
43
46
  # @param key [Symbol]
44
47
  # @param base [Config::Index]
45
48
  # @return [Object]
46
- #: (?Symbol?) -> (String | Hash[untyped, untyped] | Float | bool)?
49
+ #: () -> Hash[untyped, untyped]
50
+ #: (Symbol) -> untyped
47
51
  def config_params(key = nil)
48
52
  @config_params ||= {}
49
53
  if @config_params["#{config_index.cache_key},#{key}"]
@@ -86,9 +86,13 @@ module Fusuma
86
86
  # Detectors::PinchDetector,
87
87
  # Detectors::SwipeDetector]}
88
88
 
89
- # @param plugin_class [Class]
90
- # return [Hash, false]
91
- #: (plugin_class: Class, plugin_path: String) -> Array[untyped]?
89
+ # Register a plugin class with the manager.
90
+ # @param plugin_class [Class] the plugin class to register
91
+ # @param plugin_path [String] the file path of the plugin
92
+ # @return [false] if plugin already exists
93
+ # @return [nil] if search_key was already required
94
+ # @return [Array<String>] loaded plugin paths from gems
95
+ #: (plugin_class: Class, plugin_path: String) -> (Array[String] | false | nil)
92
96
  def add(plugin_class:, plugin_path:)
93
97
  return false if exist?(plugin_class: plugin_class, plugin_path: plugin_path)
94
98
 
@@ -110,7 +114,7 @@ module Fusuma
110
114
  manager.require_siblings_from_gems
111
115
  end
112
116
 
113
- #: () -> void
117
+ #: () -> bool
114
118
  def require_base_plugins
115
119
  require_relative "base"
116
120
  require_relative "events/event"
@@ -122,7 +126,7 @@ module Fusuma
122
126
  require_relative "executors/executor"
123
127
  end
124
128
 
125
- #: () -> Hash[untyped, untyped]
129
+ #: () -> Hash[String, Array[Class]]
126
130
  def plugins
127
131
  @plugins ||= {}
128
132
  end
@@ -138,10 +142,16 @@ module Fusuma
138
142
  @load_paths ||= []
139
143
  end
140
144
 
141
- # @param plugin_class [Class]
142
- # @return [Boolean]
145
+ # Check if a plugin class is already registered.
146
+ # Note: This intentionally returns false if only the path is registered,
147
+ # allowing multiple plugin classes from the same file (e.g., subclasses).
148
+ # @param plugin_class [Class] the plugin class to check
149
+ # @param plugin_path [String] the file path of the plugin (not used for existence check)
150
+ # @return [Boolean] true if plugin class is already registered
143
151
  #: (plugin_class: Class, plugin_path: String) -> bool
144
152
  def exist?(plugin_class:, plugin_path:)
153
+ # Skip existence check if path is already in load_paths
154
+ # This allows multiple classes from the same file to be registered
145
155
  return false if load_paths.include?(plugin_path)
146
156
 
147
157
  base = plugin_class.superclass.name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = "3.11.0"
4
+ VERSION = "3.11.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-09 00:00:00.000000000 Z
11
+ date: 2026-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
14
14
  on Linux able to recognize swipes or pinchs and assign command to them. Read installation