class DisableMacroAction
Public Class Methods
new(obj=nil)
click to toggle source
Calls superclass method
MacroDroidAction::new
# File lib/ruby-macrodroid/actions.rb, line 1912 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 # state: 0 = enable, 1 = disable, 2 = toggle options = {macro_name: "Change brightness", state: 1, GUID: nil} super(options.merge h) end
Public Instance Methods
to_s(colour: false, indent: 0)
click to toggle source
Calls superclass method
MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 1943 def to_s(colour: false, indent: 0) state = %w(Enable Disable Toggle)[@h[:state]] @s = state + ' macro'# + @h.inspect @s += "\n" + @h[:macro_name] super() end
Also aliased as: to_summary