Class: Voicemeeter::Event
- Inherits:
-
Object
- Object
- Voicemeeter::Event
- Defined in:
- lib/voicemeeter/event.rb
Instance Attribute Summary collapse
-
#ldirty ⇒ Object
Returns the value of attribute ldirty.
-
#mdirty ⇒ Object
Returns the value of attribute mdirty.
-
#midi ⇒ Object
Returns the value of attribute midi.
-
#pdirty ⇒ Object
Returns the value of attribute pdirty.
Instance Method Summary collapse
- #add(events) ⇒ Object
- #any? ⇒ Boolean
- #get ⇒ Object
- #info(msg = nil) ⇒ Object
-
#initialize(pdirty: true, mdirty: true, midi: true, ldirty: false) ⇒ Event
constructor
A new instance of Event.
- #remove(events) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(pdirty: true, mdirty: true, midi: true, ldirty: false) ⇒ Event
Returns a new instance of Event.
5 6 7 8 9 10 |
# File 'lib/voicemeeter/event.rb', line 5 def initialize(pdirty: true, mdirty: true, midi: true, ldirty: false) @pdirty = pdirty @mdirty = mdirty @midi = midi @ldirty = ldirty end |
Instance Attribute Details
#ldirty ⇒ Object
Returns the value of attribute ldirty.
3 4 5 |
# File 'lib/voicemeeter/event.rb', line 3 def ldirty @ldirty end |
#mdirty ⇒ Object
Returns the value of attribute mdirty.
3 4 5 |
# File 'lib/voicemeeter/event.rb', line 3 def mdirty @mdirty end |
#midi ⇒ Object
Returns the value of attribute midi.
3 4 5 |
# File 'lib/voicemeeter/event.rb', line 3 def midi @midi end |
#pdirty ⇒ Object
Returns the value of attribute pdirty.
3 4 5 |
# File 'lib/voicemeeter/event.rb', line 3 def pdirty @pdirty end |
Instance Method Details
#add(events) ⇒ Object
54 55 56 57 |
# File 'lib/voicemeeter/event.rb', line 54 def add(events) events = [events] if !events.respond_to? :each events.each { |ev| send("#{ev}=", true) } end |
#any? ⇒ Boolean
50 51 52 |
# File 'lib/voicemeeter/event.rb', line 50 def any? [pdirty, mdirty, midi, ldirty].any? end |
#get ⇒ Object
46 47 48 |
# File 'lib/voicemeeter/event.rb', line 46 def get %w[pdirty mdirty midi ldirty].reject { |ev| !send("#{ev}") } end |
#info(msg = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/voicemeeter/event.rb', line 16 def info(msg = nil) info_msg = msg ? ["#{msg} events."] : [] if any? info_msg += ["Now listening for #{get.join(", ")} events"] else info_msg += ["Not listening for any events"] end LOGGER.info(info_msg.join(" ")) end |
#remove(events) ⇒ Object
59 60 61 62 |
# File 'lib/voicemeeter/event.rb', line 59 def remove(events) events = [events] if !events.respond_to? :each events.each { |ev| send("#{ev}=", false) } end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/voicemeeter/event.rb', line 12 def to_s "#{self.class.name.split("::").last}" end |