Class: Fusuma::Plugin::Appmatcher::Cosmic::Matcher
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Appmatcher::Cosmic::Matcher
- Defined in:
- lib/fusuma/plugin/appmatcher/cosmic.rb
Instance Method Summary collapse
- #active_application ⇒ String?
- #on_active_application_changed ⇒ Object
- #running_applications ⇒ Array<String>
Instance Method Details
#active_application ⇒ String?
59 60 61 |
# File 'lib/fusuma/plugin/appmatcher/cosmic.rb', line 59 def active_application extract_activated_app_id(fetch_info) end |
#on_active_application_changed ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fusuma/plugin/appmatcher/cosmic.rb', line 75 def on_active_application_changed last = UNSET subscribe_state_change do |state| app_id = extract_activated_app_id(state) next if app_id == last last = app_id yield(app_id || "NOT FOUND") end rescue => e MultiLogger.error "Cosmic subscription error: #{e.}" sleep 1 retry end |
#running_applications ⇒ Array<String>
64 65 66 67 68 |
# File 'lib/fusuma/plugin/appmatcher/cosmic.rb', line 64 def running_applications state = fetch_info return [] unless state (state["apps"] || []).map { |a| a["app_id"] }.compact.uniq end |