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.
610 611 612 613 614 615 616 617 618 619 |
# File 'lib/ruby-macrodroid/actions.rb', line 610 def initialize(h={}) = { constraint_list: '' } super(.merge h) @label = 'Else If ' end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
# File 'lib/ruby-macrodroid/actions.rb', line 621 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
638 639 640 |
# File 'lib/ruby-macrodroid/actions.rb', line 638 def to_summary(colour: false) 'foo' end |