class LoopAction
Conditions/Loops
Public Class Methods
new(h={})
click to toggle source
Calls superclass method
Action::new
# File lib/ruby-macrodroid/actions.rb, line 531 def initialize(h={}) options = { } h2 = options.merge(h) super(h2) @label = 'DO / WHILE ' end
Public Instance Methods
to_s(colour: false, indent: 0)
click to toggle source
# File lib/ruby-macrodroid/actions.rb, line 545 def to_s(colour: false, indent: 0) h = @h.clone h.delete :macro @s = 'DO / WHILE ' operator = @h[:is_or_condition] ? 'OR' : 'AND' constraints = @constraints.map \ {|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator) out = [] out << "; %s" % @h[:comment] if @h[:comment] s = @s.lines.map {|x| (' ' * indent) + x}.join out << s + constraints out.join("\n") end