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.
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1708 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
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1731 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 |