Class: Marantz::Client
- Inherits:
-
Object
- Object
- Marantz::Client
- Defined in:
- lib/marantz/client.rb
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #mute ⇒ Object
- #off ⇒ Object
- #on ⇒ Object
- #source ⇒ Object
- #source=(name) ⇒ Object
- #unmute ⇒ Object
- #volume ⇒ Object
- #volume=(db) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/marantz/client.rb', line 5 def initialize raise UnsupportedModel unless SUPPORTED_MODELS.values.include?(status[:model]) end |
Instance Method Details
#mute ⇒ Object
28 29 30 |
# File 'lib/marantz/client.rb', line 28 def mute toggle_mute(:on) end |
#off ⇒ Object
40 41 42 |
# File 'lib/marantz/client.rb', line 40 def off toggle_power(:off) end |
#on ⇒ Object
36 37 38 |
# File 'lib/marantz/client.rb', line 36 def on toggle_power(:on) end |
#source ⇒ Object
13 14 15 |
# File 'lib/marantz/client.rb', line 13 def source status[:source] end |
#source=(name) ⇒ Object
9 10 11 |
# File 'lib/marantz/client.rb', line 9 def source=(name) perform(PATHS[:main_zone], COMMANDS[:source] % (SOURCES[name] or raise UnknownSource)) end |
#unmute ⇒ Object
32 33 34 |
# File 'lib/marantz/client.rb', line 32 def unmute toggle_mute(:off) end |
#volume ⇒ Object
24 25 26 |
# File 'lib/marantz/client.rb', line 24 def volume status[:volume] end |
#volume=(db) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/marantz/client.rb', line 17 def volume=(db) db = db.to_f raise VolumeTooHigh if db > Marantz.config.max_volume path = PATHS[:main_zone] perform(path, COMMANDS[:volume] % db_to_volume(db)) end |