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.
182 183 184 185 |
# File 'lib/rkremap.rb', line 182 def initialize(winattr) @winattr = winattr @win = winattr.focus_win end |
Instance Method Details
#class_name ⇒ String?
188 189 190 |
# File 'lib/rkremap.rb', line 188 def class_name @winattr.app_win(@win)[2] if @winattr && @win end |
#match?(app) ⇒ Boolean
199 200 201 202 203 204 205 |
# File 'lib/rkremap.rb', line 199 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
209 210 211 212 213 214 215 216 217 218 |
# File 'lib/rkremap.rb', line 209 def match_sub(a, b) case a when String a == b when Regexp a =~ b else false end end |
#title ⇒ String?
193 194 195 |
# File 'lib/rkremap.rb', line 193 def title @winattr.app_title(@win) if @winattr && @win end |