Class: AppleMusicLibrary::Decade
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(year_name) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/apple_music_library/decade.rb', line 12
def self.find_or_create_for(year_name)
decade_start_year = year_name.to_i - (year_name.to_i % 10)
decade_stop_year = decade_start_year + 9
decade_name = "#{decade_start_year}-#{decade_stop_year}"
self.find_or_create(decade_name)
end
|
.report ⇒ Object
6
7
8
9
10
|
# File 'lib/apple_music_library/decade.rb', line 6
def self.report
self.all.sort_by{|d| d.name}.each do |decade|
puts "#{decade.name} - #{decade.track_count} tracks on #{decade.album_count} albums"
end
end
|
.token ⇒ Object
20
21
22
|
# File 'lib/apple_music_library/decade.rb', line 20
def self.token
:decade
end
|