Class: ElseAction

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

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(obj = []) ⇒ ElseAction

Returns a new instance of ElseAction.



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/ruby-macrodroid/actions.rb', line 600

def initialize(obj=[])

  options = {
    constraint_list: []
  }
  
  if obj.is_a? Hash then
    
    h = obj

    super(options.merge h)      
    
  elsif obj.is_a? Array
    
    e, macro = obj
    
    # find any nested actions
    item = e.element('item')
    
    if item then
      
      ap = ActionsNlp.new
      obj2 = action_to_object(ap, item, item, macro)      
      puts 'obj2: ' + obj2.inspect if $debug
      #macro.add obj2
      
    end
    
    super(options)
  end
  
  


end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



636
637
638
# File 'lib/ruby-macrodroid/actions.rb', line 636

def to_s(colour: false, indent: 0)
  'Else'
end