Class: IfConditionAction

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



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/ruby-macrodroid/actions.rb', line 277

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



293
294
295
296
297
298
# File 'lib/ruby-macrodroid/actions.rb', line 293

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