Class: Action

Inherits:
MacroObject show all
Includes:
ObjectX
Defined in:
lib/ruby-macrodroid/actions.rb

Instance Attribute Summary collapse

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h, #to_s

Constructor Details

#initialize(h = {}) ⇒ Action

Returns a new instance of Action.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ruby-macrodroid/actions.rb', line 42

def initialize(h={}) 
  
  macro = h[:macro]
  h.delete :macro
  super(h)

  @constraints = @h[:constraint_list].map do |constraint|
    object(constraint.to_snake_case.merge(macro: macro))
  end
  
end

Instance Attribute Details

#constraintsObject (readonly)

Returns the value of attribute constraints.



40
41
42
# File 'lib/ruby-macrodroid/actions.rb', line 40

def constraints
  @constraints
end

Instance Method Details

#invoke(h = {}) ⇒ Object



54
55
56
# File 'lib/ruby-macrodroid/actions.rb', line 54

def invoke(h={})    
  "%s/%s: %s" % [@group, @type, h.to_json]
end