Class: Apple::Music::Library::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/apple/music/library/track.rb

Constant Summary collapse

ATTRIBUTES =
['Track ID', 
'Name',
# 'Artist', The #artist, #album, and #genre methods return objects rather than strings and have methods like #artist_name to retrieve the strings.
# 'Album',
# 'Genre',
'Kind',
'Size',
'Total Time',
'Track Number',
'Year',
'Date Modified',
'Date Added',
'Bit Rate',
'Sample Rate',
'Play Count',
'Play Date',
'Play Date UTC',
'Rating',
'Album Rating',
'Album Rating Computed',
'Normalization',
'Persistent ID',
'Track Type',
'Location',
'File Folder Count',
'Library Folder Count']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Track

Returns a new instance of Track.



36
37
38
39
40
# File 'lib/apple/music/library/track.rb', line 36

def initialize(info)
  @info = info
  @artist = Artist.new(artist_name)
  @album = Album.new(@artist, album_name)
end

Instance Attribute Details

#albumObject (readonly)

Returns the value of attribute album.



7
8
9
# File 'lib/apple/music/library/track.rb', line 7

def album
  @album
end

#artistObject (readonly)

Returns the value of attribute artist.



7
8
9
# File 'lib/apple/music/library/track.rb', line 7

def artist
  @artist
end

#infoObject (readonly)

Returns the value of attribute info.



7
8
9
# File 'lib/apple/music/library/track.rb', line 7

def info
  @info
end

Instance Method Details

#album_nameObject



50
51
52
# File 'lib/apple/music/library/track.rb', line 50

def album_name
  info['Album']
end

#artist_nameObject



46
47
48
# File 'lib/apple/music/library/track.rb', line 46

def artist_name
  info['Artist']
end

#genre_nameObject



54
55
56
# File 'lib/apple/music/library/track.rb', line 54

def genre_name
  info['Genre']
end

#idObject



42
43
44
# File 'lib/apple/music/library/track.rb', line 42

def id
  track_id
end