Class: Fusuma::Plugin::Remap::DeviceMatcher
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Remap::DeviceMatcher
- Defined in:
- lib/fusuma/plugin/remap/device_matcher.rb
Overview
Matches device names against device patterns defined in config
Instance Method Summary collapse
-
#initialize ⇒ DeviceMatcher
constructor
A new instance of DeviceMatcher.
-
#match(device_name) ⇒ String?
Find matching device pattern for a device name.
Constructor Details
#initialize ⇒ DeviceMatcher
Returns a new instance of DeviceMatcher.
10 11 12 |
# File 'lib/fusuma/plugin/remap/device_matcher.rb', line 10 def initialize @patterns = nil end |
Instance Method Details
#match(device_name) ⇒ String?
Find matching device pattern for a device name
17 18 19 20 21 |
# File 'lib/fusuma/plugin/remap/device_matcher.rb', line 17 def match(device_name) return nil if device_name.nil? patterns.find { |pattern| device_name =~ /#{pattern}/i } end |