Class: Airplay::Group::Players

Inherits:
Object
  • Object
show all
Defined in:
lib/airplay/group/players.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(players) ⇒ Players

Returns a new instance of Players.



6
7
8
# File 'lib/airplay/group/players.rb', line 6

def initialize(players)
  @players = players
end

Instance Attribute Details

#playersObject (readonly)

Returns the value of attribute players.



4
5
6
# File 'lib/airplay/group/players.rb', line 4

def players
  @players
end

Instance Method Details

#progress(callback) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/airplay/group/players.rb', line 10

def progress(callback)
  players.each do |player|
    player.progress -> info {
      callback.call(player.device, info) if player.playing?
    }
  end
end

#waitObject



18
19
20
21
# File 'lib/airplay/group/players.rb', line 18

def wait
  sleep 0.1 while still_playing?
  players.map(&:cleanup)
end