Module: Hallon::Observable::PlaylistContainer

Included in:
PlaylistContainer
Defined in:
lib/hallon/observable/playlist_container.rb

Overview

Callbacks related to PlaylistContainer objects.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(other) ⇒ Object

Includes Hallon::Observable for you.


5
6
7
# File 'lib/hallon/observable/playlist_container.rb', line 5

def self.extended(other)
  other.send(:include, Hallon::Observable)
end

Instance Method Details

#container_loaded_callback(pointer, userdata) { ... } ⇒ Object (protected)

Examples:

listening to this event

playlist_container.on(:container_loaded) do |container|
  puts "#{container.owner.name}s container loaded!"
end

Yields:

  • [] container_loaded


63
64
65
# File 'lib/hallon/observable/playlist_container.rb', line 63

def container_loaded_callback(pointer, userdata)
  trigger(pointer, :container_loaded)
end

#initialize_callbacksSpotify::PlaylistContainerCallbacks (protected)


12
13
14
15
16
17
18
# File 'lib/hallon/observable/playlist_container.rb', line 12

def initialize_callbacks
  struct = Spotify::PlaylistContainerCallbacks.new
  struct.members.each do |member|
    struct[member] = callback_for(member)
  end
  struct
end

#playlist_added_callback(pointer, playlist, position, userdata) {|playlist, position| ... } ⇒ Object (protected)

Examples:

listening to this event

playlist_container.on(:playlist_added) do |playlist, position, container|
  puts playlist.name + " added at #{position}."
end

Yields:

  • (playlist, position)

    playlist_added

Yield Parameters:

  • playlist (Playlist)
  • position (Integer)

28
29
30
# File 'lib/hallon/observable/playlist_container.rb', line 28

def playlist_added_callback(pointer, playlist, position, userdata)
  trigger(pointer, :playlist_added, Hallon::Playlist.from(playlist), position)
end

#playlist_moved_callback(pointer, playlist, position, new_position, userdata) {|playlist, position, new_position| ... } ⇒ Object (protected)

Examples:

listening to this event

playlist_container.on(:playlist_moved) do |playlist, position, new_position, container|
  puts "moved #{playlist.name} from #{position} to #{new_position}"
end

Yields:

  • (playlist, position, new_position)

    playlist_moved

Yield Parameters:

  • playlist (Playlist)
  • position (Integer)
  • new_position (Integer)

53
54
55
# File 'lib/hallon/observable/playlist_container.rb', line 53

def playlist_moved_callback(pointer, playlist, position, new_position, userdata)
  trigger(pointer, :playlist_moved, Hallon::Playlist.from(playlist), position, new_position)
end

#playlist_removed_callback(pointer, playlist, position, userdata) {|playlist, position| ... } ⇒ Object (protected)

Examples:

listening to this event

playlist_container.on(:playlist_removed) do |playlist, position, container|
  puts playlist.name + " removed from #{position}."
end

Yields:

  • (playlist, position)

    playlist_removed

Yield Parameters:

  • playlist (Playlist)
  • position (Integer)

40
41
42
# File 'lib/hallon/observable/playlist_container.rb', line 40

def playlist_removed_callback(pointer, playlist, position, userdata)
  trigger(pointer, :playlist_removed, Hallon::Playlist.from(playlist), position)
end