Class: IfConditionAction

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

Direct Known Subclasses

ElseIfConditionAction

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ IfConditionAction

Returns a new instance of IfConditionAction.



2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
# File 'lib/ruby-macrodroid.rb', line 2989

def initialize(h={})
  
  options = {
    a: true,
    constraint_list: ''
  }
  
  macro = h[:macro]
  h2 = options.merge(filter(options,h).merge(macro: macro))

  super(h2)
  
  @label = 'If '

end

Instance Method Details

#to_s(colour: false) ⇒ Object



3005
3006
3007
3008
3009
3010
# File 'lib/ruby-macrodroid.rb', line 3005

def to_s(colour: false)
  
  @s = "If " #+ @constraints.map(&:to_s).join(" %s " % operator)
  super(colour: colour)
  
end