Class: Rkremap::App
- Inherits:
-
Object
- Object
- Rkremap::App
- Defined in:
- lib/rkremap.rb
Instance Method Summary collapse
- #class_name ⇒ String?
-
#initialize(winattr) ⇒ App
constructor
A new instance of App.
- #match?(app) ⇒ Boolean
- #match_sub(a, b) ⇒ Object
- #title ⇒ String?
Constructor Details
#initialize(winattr) ⇒ App
Returns a new instance of App.
185 186 187 188 |
# File 'lib/rkremap.rb', line 185 def initialize(winattr) @winattr = winattr @win = winattr.focus_win end |
Instance Method Details
#class_name ⇒ String?
191 192 193 |
# File 'lib/rkremap.rb', line 191 def class_name @winattr.class_name(@win) if @winattr && @win end |
#match?(app) ⇒ Boolean
202 203 204 205 206 207 208 |
# File 'lib/rkremap.rb', line 202 def match?(app) [app].flatten.each do |a| a = {class_name: a, title: a} unless a.is_a? Hash return true if match_sub(a[:class_name], class_name) || match_sub(a[:title], title) end false end |
#match_sub(a, b) ⇒ Object
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/rkremap.rb', line 212 def match_sub(a, b) case a when String a == b when Regexp a =~ b else false end end |
#title ⇒ String?
196 197 198 |
# File 'lib/rkremap.rb', line 196 def title @winattr.app_title(@win) if @winattr && @win end |