Class: IfConditionAction

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

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #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.



2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
# File 'lib/ruby-macrodroid.rb', line 2574

def initialize(h={})

  options = {
    a: true,
    constraint_list: ''
  }

  super(options.merge h)

end

Instance Method Details

#to_sObject



2585
2586
2587
2588
2589
2590
2591
2592
# File 'lib/ruby-macrodroid.rb', line 2585

def to_s()
  
  operator = @h[:is_or_condition] ? 'OR' : 'AND'
  r = 'If ' + @constraints.map(&:to_s).join(" %s " % operator)
  puts 'if ... @h ' + @h.inspect
  r
  
end