Class: ForceMacroRunAction
- Inherits:
-
MacroDroidAction
- Object
- MacroObject
- Action
- MacroDroidAction
- ForceMacroRunAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj = nil) ⇒ ForceMacroRunAction
constructor
A new instance of ForceMacroRunAction.
- #invoke ⇒ Object
- #to_s(colour: false, indent: 0) ⇒ Object (also: #to_summary)
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(obj = nil) ⇒ ForceMacroRunAction
Returns a new instance of ForceMacroRunAction.
1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 |
# File 'lib/ruby-macrodroid/actions.rb', line 1825 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 = { guid: nil, ignore_constraints: true, macro_name: "", use_off_status: false, user_prompt_title: "Run Macro" } super(.merge h) end |
Instance Method Details
#invoke ⇒ Object
1858 1859 1860 |
# File 'lib/ruby-macrodroid/actions.rb', line 1858 def invoke() super(macro_name: @h[:macro_name]) end |
#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary
1862 1863 1864 1865 1866 1867 1868 |
# File 'lib/ruby-macrodroid/actions.rb', line 1862 def to_s(colour: false, indent: 0) @s = 'Macro Run'# + @h.inspect @s += "\n" + @h[:macro_name] super() end |