Class: Trigger

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

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #type

Instance Method Summary collapse

Methods inherited from MacroObject

#to_h, #to_s

Constructor Details

#initialize(h = {}) ⇒ Trigger

Returns a new instance of Trigger.



1086
1087
1088
1089
# File 'lib/ruby-macrodroid.rb', line 1086

def initialize(h={})    
  super({fakeIcon: 0}.merge(h))
  @list << 'fakeIcon'
end

Instance Method Details

#match?(detail = {}, model = nil) ⇒ Boolean

Returns:

  • (Boolean)


1091
1092
1093
1094
1095
1096
# File 'lib/ruby-macrodroid.rb', line 1091

def match?(detail={}, model=nil)

  # only match where the key exists in the trigger object
  detail.select {|k,v| @h.include? k }.all? {|key,value| @h[key] == value}

end