Method: Macro#to_summary

Defined in:
lib/ruby-macrodroid/macro.rb

#to_summary(colour: false) ⇒ Object



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/ruby-macrodroid/macro.rb', line 556

def to_summary(colour: false)
  
  if colour then
    
    a = [
      'm'.bg_cyan.gray.bold + ': ' + @title,
      't'.bg_red.gray.bold + ': ' + @triggers.map \
    {|x| x.to_summary(colour: false)}.join(", "),
      'a'.bg_blue.gray.bold + ': ' + @actions.map \
    {|x| x.to_summary(colour: false)}.join(", ")
    ]
    
    if @constraints.any? then
      a <<  'c'.bg_green.gray.bold + ': ' + @constraints.map \
          {|x| x.to_summary(colour: false)}.join(", ") 
    end      
    
  else
    
    a = [
      'm: ' + @title,
      't: ' + @triggers.map {|x| x.to_summary(colour: false)}.join(", "),
      'a: ' + @actions.map {|x| x.to_summary(colour: false)}.join(", ")
    ]
    
    if @constraints.any? then
      a <<  'c: ' + @constraints.map \
          {|x| x.to_summary(colour: false)}.join(", ") 
    end
  end
  
  
  
  a.join("\n") + "\n"
  
end