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.



689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/ruby-macrodroid/actions.rb', line 689

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



725
726
727
# File 'lib/ruby-macrodroid/actions.rb', line 725

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