class MediaButtonV2Trigger

Public Class Methods

new(obj=nil) click to toggle source
Calls superclass method Trigger::new
# File lib/ruby-macrodroid/triggers.rb, line 1729
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 = {
    options_enabled_array: [true, false, false, false, false, false, false]
  }

  super(options.merge h)

end

Public Instance Methods

to_s(colour: false) click to toggle source
Calls superclass method Trigger#to_s
# File lib/ruby-macrodroid/triggers.rb, line 1752
def to_s(colour: false)
  
  
  options = @a.zip(@h[:options_enabled_array]).select(&:last).map(&:first)
  
  @s = 'Media Button V2 ' #+ @h.inspect
  @s += "\n" + options.join(', ')
  super()
  
end
Also aliased as: to_summary
to_summary(colour: false)
Alias for: to_s