Class: AppleMusicLibrary::Century
Instance Attribute Summary
#name, #tracks
Class Method Summary
collapse
#add_track, #album_count, all, find_by_name, find_or_create, #initialize, #star_rating, #track_count
Class Method Details
.find_or_create_for(century_name) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/apple_music_library/century.rb', line 12
def self.find_or_create_for(century_name)
century_start_year = century_name.to_i - (century_name.to_i % 100)
century_stop_year = century_start_year + 99
century_name = "#{century_start_year}'s"
self.find_or_create(century_name)
end
|
.report ⇒ Object
6
7
8
9
10
|
# File 'lib/apple_music_library/century.rb', line 6
def self.report
self.all.sort_by{|c| c.name}.each do |century|
puts "#{century.name} - #{century.track_count} tracks on #{century.album_count} albums"
end
end
|
.token ⇒ Object
20
21
22
|
# File 'lib/apple_music_library/century.rb', line 20
def self.token
:century
end
|