Skip to content

Commit

Permalink
Merge pull request George7h#44 from George7h/features-create-music-la…
Browse files Browse the repository at this point in the history
…bel-class

Create Music and Genre class
  • Loading branch information
Fombi-Favour authored Dec 20, 2023
2 parents a420ed3 + 2376719 commit cb242b7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions classes/genre.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require './classes/item'

class Genre < Item
attr_accessor :name
attr_reader :id, :items

def initialize(name, id = nil)
super
@id = id || Random.random(1..1000)
@name = name
@items = []
end

def add_item(item)
@items << item
item.label = self
end
end
14 changes: 14 additions & 0 deletions classes/musicalbum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require './classes/item'

class MusicAlbum < Item
attr_accessor :on_spotify

def initialize(genre, author, source, label, publish_date, on_spotify)
super(genre, author, source, label, publish_date)
@on_spotify = on_spotify
end

def can_be_archived?
super || @on_spotify
end
end

0 comments on commit cb242b7

Please sign in to comment.