Class: ActiveApplicationConstraint

Inherits:
Constraint show all
Defined in:
lib/ruby-macrodroid/constraints.rb

Overview

Category: application

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Constraint

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ ActiveApplicationConstraint

Returns a new instance of ActiveApplicationConstraint.



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ruby-macrodroid/constraints.rb', line 65

def initialize(h={})

  options = {
    :application_name_list=>["YouTube"], 
    :foreground=>true, 
    :package_name_list=>["com.google.android.youtube"]      
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/ruby-macrodroid/constraints.rb', line 77

def to_s(colour: false, indent: 0)
  
  indentx = '  ' * indent
  mode = @h[:foreground] ? 'foreground' : 'not foreground'
  apps = @h[:application_name_list]
  indentx + 'App ' + mode + "\n  " + indentx + apps.join(', ') #+ @h.inspect
end

#to_summary(colour: false, indent: 0) ⇒ Object



85
86
87
88
89
90
# File 'lib/ruby-macrodroid/constraints.rb', line 85

def to_summary(colour: false, indent: 0)
  
  mode = @h[:foreground] ? 'foreground' : 'not foreground'
  apps = @h[:application_name_list]
  'App ' + mode + " (%s)" % apps.join(', ') #+ @h.inspect
end