Class: Caldera::Model::LoadTracks
- Inherits:
-
Object
- Object
- Caldera::Model::LoadTracks
- Includes:
- Enumerable
- Defined in:
- lib/caldera/model/load_tracks.rb
Overview
Represents the struct returned from Client#load_tracks
Instance Attribute Summary collapse
- #load_type ⇒ :TRACK_LOADED, ... readonly
- #playlist_info ⇒ PlaylistInfo readonly
- #tracks ⇒ Array<Track> readonly
Instance Method Summary collapse
-
#each {|| ... } ⇒ Object
Operate on each track.
-
#initialize(data) ⇒ LoadTracks
constructor
A new instance of LoadTracks.
Constructor Details
#initialize(data) ⇒ LoadTracks
Returns a new instance of LoadTracks.
18 19 20 21 22 23 24 |
# File 'lib/caldera/model/load_tracks.rb', line 18 def initialize(data) playlist_info = data['playlistInfo'] @playlist_info = PlaylistInfo.new(playlist_info) if playlist_info @tracks = data['tracks'].collect { |track_data| Model::Track.new(track_data) } @load_type = data['loadType'].to_sym end |
Instance Attribute Details
#load_type ⇒ :TRACK_LOADED, ... (readonly)
16 17 18 |
# File 'lib/caldera/model/load_tracks.rb', line 16 def load_type @load_type end |
#playlist_info ⇒ PlaylistInfo (readonly)
10 11 12 |
# File 'lib/caldera/model/load_tracks.rb', line 10 def playlist_info @playlist_info end |
#tracks ⇒ Array<Track> (readonly)
13 14 15 |
# File 'lib/caldera/model/load_tracks.rb', line 13 def tracks @tracks end |
Instance Method Details
#each {|| ... } ⇒ Object
Operate on each track.
28 29 30 |
# File 'lib/caldera/model/load_tracks.rb', line 28 def each(&block) @tracks.each(&block) end |