Class: MPD::Commands::Play

Inherits:
Abstract show all
Defined in:
lib/mpd/commands/play.rb

Overview

Play specific song (by id or cur. playlist position).

Instance Attribute Summary

Attributes inherited from Abstract

#connection

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from MPD::Commands::Abstract

Instance Method Details

#execute(position: nil, id: nil) ⇒ Object

Raises:

  • (ArgumentError)

10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mpd/commands/play.rb', line 10

def execute(position: nil, id: nil)
  raise(ArgumentError, 'too many arguments') if position && id

  if position
    super("play #{position}")
  elsif id
    super("playid #{id}")
  else
    super('play')
  end
end