Class: ElseIfConditionAction
- Inherits:
-
Action
- Object
- MacroObject
- Action
- ElseIfConditionAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ ElseIfConditionAction
constructor
A new instance of ElseIfConditionAction.
- #to_s(colour: false, indent: 0) ⇒ Object
- #to_summary(colour: false) ⇒ Object
Methods inherited from Action
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ElseIfConditionAction
Returns a new instance of ElseIfConditionAction.
542 543 544 545 546 547 548 549 550 551 |
# File 'lib/ruby-macrodroid/actions.rb', line 542 def initialize(h={}) = { constraint_list: '' } super(.merge h) @label = 'Else If ' end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/ruby-macrodroid/actions.rb', line 553 def to_s(colour: false, indent: 0) h = @h.clone h.delete :macro @s = 'Else If ' 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 |
#to_summary(colour: false) ⇒ Object
570 571 572 |
# File 'lib/ruby-macrodroid/actions.rb', line 570 def to_summary(colour: false) 'foo' end |