Class: Apple::Music::Library::Genre

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Genre

Returns a new instance of Genre.



8
9
10
11
# File 'lib/apple/music/library/genre.rb', line 8

def initialize(name)
  @name = name
  @tracks = []
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/apple/music/library/genre.rb', line 6

def name
  @name
end

#tracksObject (readonly)

Returns the value of attribute tracks.



6
7
8
# File 'lib/apple/music/library/genre.rb', line 6

def tracks
  @tracks
end

Instance Method Details

#add_track(track) ⇒ Object



13
14
15
16
17
# File 'lib/apple/music/library/genre.rb', line 13

def add_track(track)
  unless tracks.include?(track)
    @tracks << track
  end
end