Class: TriggerThatInvokedConstraint

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

Overview

Category: MacroDroid Specific

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 = {}) ⇒ TriggerThatInvokedConstraint

Returns a new instance of TriggerThatInvokedConstraint.



920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
# File 'lib/ruby-macrodroid/constraints.rb', line 920

def initialize(h={})

  puts ('h: ' + h.inspect).green if $debug
  @trigger = h[:macro].triggers.find {|x| x.siguid == h[:si_guid_that_invoked] }
  
  options = {
    not: false,
    si_guid_that_invoked: -4951291100076165433,
    trigger_name: 'Shake Device'
  }

  #super(options.merge filter(options,h))
  super(options.merge h)

end

Instance Method Details

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



936
937
938
# File 'lib/ruby-macrodroid/constraints.rb', line 936

def to_s(colour: false, indent: 0)
  'Trigger Fired: ' + @trigger.to_s(colour: colour)
end

#to_summary(colour: false) ⇒ Object



940
941
942
943
944
945
946
947
# File 'lib/ruby-macrodroid/constraints.rb', line 940

def to_summary(colour: false)
  #puts '@trigger' + @trigger.inspect
  if @trigger then
    'Trigger Fired: ' + @trigger.to_summary(colour: colour)
  else
    'Trigger Fired: Trigger not found; guid: ' + @h[:si_guid_that_invoked].inspect
  end
end