Class: TriggerThatInvokedConstraint

Inherits:
Constraint show all
Defined in:
lib/ruby-macrodroid.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.



5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
# File 'lib/ruby-macrodroid.rb', line 5485

def initialize(h={})

  puts ('h: ' + h.inspect).green
  @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) ⇒ Object



5501
5502
5503
# File 'lib/ruby-macrodroid.rb', line 5501

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

#to_summary(colour: false) ⇒ Object



5505
5506
5507
5508
5509
5510
5511
5512
# File 'lib/ruby-macrodroid.rb', line 5505

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