Class: MediaButtonV2Trigger
- Inherits:
-
Trigger
- Object
- MacroObject
- Trigger
- MediaButtonV2Trigger
- Defined in:
- lib/ruby-macrodroid/triggers.rb
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj = nil) ⇒ MediaButtonV2Trigger
constructor
A new instance of MediaButtonV2Trigger.
- #to_s(colour: false) ⇒ Object (also: #to_summary)
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(obj = nil) ⇒ MediaButtonV2Trigger
Returns a new instance of MediaButtonV2Trigger.
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1725 def initialize(obj=nil) @a = %w(Play Play/Pause Pause Stop Previous Next Headset Hook) h = if obj.is_a? Hash then obj elsif obj.is_a? Array e, macro = obj s = e.text('item/description').to_s a = s.split(/, /) {options_enabled_array: @a.map {|x| a.include? x } } end = { options_enabled_array: [true, false, false, false, false, false, false] } super(.merge h) end |
Instance Method Details
#to_s(colour: false) ⇒ Object Also known as: to_summary
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1748 def to_s(colour: false) = @a.zip(@h[:options_enabled_array]).select(&:last).map(&:first) @s = 'Media Button V2 ' #+ @h.inspect @s += "\n" + .join(', ') super() end |