Class: ITuner::Playlist

Inherits:
Model
  • Object
show all
Defined in:
lib/ituner/playlist.rb

Instance Attribute Summary

Attributes inherited from Model

#app_object

Instance Method Summary collapse

Methods inherited from Model

#==, action, belongs_to, has_many, #initialize, #inspect, property

Constructor Details

This class inherits a constructor from ITuner::Model

Instance Method Details

#add(track) ⇒ Object



31
32
33
# File 'lib/ituner/playlist.rb', line 31

def add(track)
  ITuner.itunes_app.duplicate(track.app_object, :to => app_object)
end

#clearObject



21
22
23
# File 'lib/ituner/playlist.rb', line 21

def clear
  tracks.clear
end

#playObject



35
36
37
# File 'lib/ituner/playlist.rb', line 35

def play
  app_object.play(:once => true)
end

#search(name, only = :all) ⇒ Object



25
26
27
28
29
# File 'lib/ituner/playlist.rb', line 25

def search(name, only = :all)
  ITuner.itunes_app.search(app_object, :for => name, :only => only).map do |app_track|
    Track.new(app_track)
  end
end