class Spotify::Music::Importer::CollectionRecord

Public Class Methods

new(row, options = {}) click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 7
def initialize(row, options = {})
  @row = row
  @clean_album = options.delete(:clean_album) { false }
  @clean_track = options.delete(:clean_track) { false }
end

Public Instance Methods

album() click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 29
def album
  if @clean_album
    AlbumNameCleaner.new(@row['Album']).clean
  else
    @row['Album']
  end
end
artist() click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 21
def artist
  if @clean_album
    @row['Artist'].gsub('(Special Edition)', '').strip
  else
    @row['Artist']
  end
end
name() click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 13
def name
  if @clean_track
    TrackNameCleaner.new(@row['Name']).clean
  else
    @row['Name']
  end
end
to_json(options = {}) click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 41
def to_json(options = {})
  { :name => name, :album => album, :artist => artist }.to_json(options)
end
to_s() click to toggle source
# File lib/spotify/music/importer/collection_record.rb, line 37
def to_s
  "Name: #{name} Album: #{album} Artist: #{artist}"
end