Class: IfConditionAction

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

Overview

Conditions/Loops

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(obj = nil) ⇒ IfConditionAction

Returns a new instance of IfConditionAction.



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/ruby-macrodroid/actions.rb', line 359

def initialize(obj=nil)
  
  h = if obj.is_a? Hash then
    obj
  else
    # get the constraints

  end
  
  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



382
383
384
385
386
387
# File 'lib/ruby-macrodroid/actions.rb', line 382

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