Class: MPD::Controller::Audio::Output
- Inherits:
-
Object
- Object
- MPD::Controller::Audio::Output
- Defined in:
- lib/mpd/controller/audio.rb
Instance Attribute Summary collapse
-
#audio ⇒ Object
readonly
Returns the value of attribute audio.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #disable! ⇒ Object
- #enable! ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(audio, id) ⇒ Output
constructor
A new instance of Output.
- #inspect ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(audio, id) ⇒ Output
Returns a new instance of Output.
17 18 19 20 |
# File 'lib/mpd/controller/audio.rb', line 17 def initialize (audio, id) @audio = audio @id = id end |
Instance Attribute Details
#audio ⇒ Object (readonly)
Returns the value of attribute audio.
15 16 17 |
# File 'lib/mpd/controller/audio.rb', line 15 def audio @audio end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/mpd/controller/audio.rb', line 15 def id @id end |
Instance Method Details
#disable! ⇒ Object
40 41 42 43 44 |
# File 'lib/mpd/controller/audio.rb', line 40 def disable! audio.controller.do_and_raise_if_needed :disableoutput, id self end |
#enable! ⇒ Object
34 35 36 37 38 |
# File 'lib/mpd/controller/audio.rb', line 34 def enable! audio.controller.do_and_raise_if_needed :enableoutput, id self end |
#enabled? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/mpd/controller/audio.rb', line 28 def enabled? audio.controller.do_and_raise_if_needed(:outputs).each_slice(3) {|(_, id), (_, name), (_, enabled)| return enabled if @id == id } end |
#inspect ⇒ Object
46 47 48 |
# File 'lib/mpd/controller/audio.rb', line 46 def inspect "#<#{self.class.name}(#{id}, #{enabled? ? 'enabled' : 'disabled'}): #{name}>" end |
#name ⇒ Object
22 23 24 25 26 |
# File 'lib/mpd/controller/audio.rb', line 22 def name audio.controller.do_and_raise_if_needed(:outputs).each_slice(3) {|(_, id), (_, name), (_, enabled)| return name if @id == id } end |