class RJL::Album

Represents an album in Apple’s ‘iTunes’ application.

Attributes

album_artist[R]
genre[RW]
title[R]
tracks[R]

Public Class Methods

new( tracks: []) click to toggle source

Creates a new RJL::Album. Album properties are derived from the properties of the supplied tracks. @param [List of Track] tracks the album tracks

# File lib/rjl/album.rb, line 13
def initialize( tracks: [])
  @tracks = tracks
end

Public Instance Methods

genre=(str) click to toggle source

@param [String] album genre

# File lib/rjl/album.rb, line 47
def genre=(str)
  if !self.protected?
    @tracks.each do |track|
      track.genre = str
    end
  end
end
protected?() click to toggle source

Is the album protected from changes? @return [Boolean] true if it is

# File lib/rjl/album.rb, line 63
def protected?
  protected = false
  @tracks.each do |track|
    if track.tags.include? 'protected'
      protected = true
      break
    end
  end
  return protected
end
to_s() click to toggle source
# File lib/rjl/album.rb, line 74
def to_s
  puts "-"*50
  puts "> #{self.album_artist}, '#{self.title}'"
  @tracks.each do |track|
    puts "  #{track.name}"
  end
  puts "="*50
end