generated from ger619/ruby-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
music_methods.rb
37 lines (33 loc) · 1 KB
/
music_methods.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require_relative './app'
require_relative './musicalbum'
def list_music
if @music_list.empty?
puts 'Music list is empty'
else
@music_list.each_with_index do |music, index|
puts "(#{index}) ID: #{music.id} On Spotify: \"#{music.on_spotify}\", Publish Date: #{music.publish_date} Archived: #{music.archived}" # rubocop:disable Layout/LineLength
end
end
end
def create_music
puts 'Is it on spotify? [y/n]: '
on_spotify = gets.chomp
puts 'Please state when was the music published [yyyy/mm/dd]:'
publish_date = gets.chomp
print 'Music Album Added Succesfully'
new_music = MusicAlbum.new(on_spotify, publish_date)
@music_list.push(new_music)
end
def add_music(on_spotify, publish_date)
new_music = MusicAlbum.new(on_spotify, publish_date)
@music_list << new_music
end
def list_labels
if @label_list.empty?
puts 'Label list is empty'
else
@label_list.each_with_index do |label, index|
puts "(#{index}) Title: \"#{label.title}\", Color: #{label.color}"
end
end
end