Class: MusicPlayingTrigger

Inherits:
DeviceEventsTrigger show all
Defined in:
lib/ruby-macrodroid/triggers.rb

Overview

Category: Device Events

Instance Attribute Summary

Attributes inherited from Trigger

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ MusicPlayingTrigger

Returns a new instance of MusicPlayingTrigger.



1000
1001
1002
1003
1004
1005
1006
1007
1008
# File 'lib/ruby-macrodroid/triggers.rb', line 1000

def initialize(h={})

  options = {
    option: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



1010
1011
1012
1013
1014
1015
1016
# File 'lib/ruby-macrodroid/triggers.rb', line 1010

def to_s(colour: false)
  
  event = @h[:option] == 0 ? 'Started' : 'Stopped'
  @s = 'Music/Sound Playing' + "\n  %s" % event #+ @h.inspect
  super()
  
end

#to_summary(colour: false) ⇒ Object



1018
1019
1020
1021
# File 'lib/ruby-macrodroid/triggers.rb', line 1018

def to_summary(colour: false)
  event = @h[:option] == 0 ? 'Started' : 'Stopped'
  @s = 'Music/Sound Playing' + " (%s)" % event #+ @h.inspect    
end