Class: LoopAction
- Inherits:
-
Action
- Object
- MacroObject
- Action
- LoopAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Conditions/Loops
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ LoopAction
constructor
A new instance of LoopAction.
- #to_s(colour: false, indent: 0) ⇒ Object
Methods inherited from Action
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ LoopAction
Returns a new instance of LoopAction.
413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/ruby-macrodroid/actions.rb', line 413 def initialize(h={}) = { } h2 = .merge(h) super(h2) @label = 'DO / WHILE ' end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/ruby-macrodroid/actions.rb', line 427 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 |