class SonosCli::DoSonos

Attributes

song[R]

Public Class Methods

new() click to toggle source
# File lib/sonos_cli.rb, line 17
def initialize
  speaker = Sonos::System.new.speakers.first
  @song = speaker.now_playing
end

Public Instance Methods

playing() click to toggle source
# File lib/sonos_cli.rb, line 22
def playing
  {
    artist: get(:artist),
    title: get(:title),
    album: get(:album)
  }
end

Private Instance Methods

get(thing) click to toggle source
# File lib/sonos_cli.rb, line 32
def get(thing)
  song.fetch(thing, 'n/a')
end