class ForceMacroRunAction

Public Class Methods

new(obj=nil) click to toggle source
Calls superclass method MacroDroidAction::new
# File lib/ruby-macrodroid/actions.rb, line 1982
def initialize(obj=nil)
  
  h = if obj.is_a? Hash then
  
    obj
    
  elsif obj.is_a? Array
    
    e, macro, h2 = obj
    
    # find the macro guid for the given name
    name = e.text('item/description').to_s
    found = macro.parent.macros.find {|macro| macro.title =~ /#{name}/ }
    
    h3 = if found then     
      {macro_name: found.title, GUID: found.guid}
    else
      {macro_name: name}
    end
    
    h3.merge h2

  end      
  
  options = {
    guid: nil, ignore_constraints: true, 
    macro_name: "", use_off_status: false, 
    user_prompt_title: "Run Macro"      
  }
  super(options.merge h)
  
end

Public Instance Methods

invoke() click to toggle source
Calls superclass method Action#invoke
# File lib/ruby-macrodroid/actions.rb, line 2015
def invoke()
  super(macro_name: @h[:macro_name])
end
to_s(colour: false, indent: 0) click to toggle source
Calls superclass method MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 2019
def to_s(colour: false, indent: 0)
  
  @s = 'Macro Run'# + @h.inspect
  @s += "\n" + @h[:macro_name]
  super()
  
end
Also aliased as: to_summary
to_summary(colour: false, indent: 0)
Alias for: to_s