Class: Spotify::Music::Importer::AlbumNameCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/spotify/music/importer/album_name_cleaner.rb

Instance Method Summary collapse

Constructor Details

#initialize(album_name) ⇒ AlbumNameCleaner

Returns a new instance of AlbumNameCleaner.



5
6
7
# File 'lib/spotify/music/importer/album_name_cleaner.rb', line 5

def initialize(album_name)
  @album_name = album_name
end

Instance Method Details

#cleanObject



9
10
11
12
13
14
15
16
17
# File 'lib/spotify/music/importer/album_name_cleaner.rb', line 9

def clean
  cleaned_album = @album_name

  extraneous_album_info.each do |album_info|
    cleaned_album = cleaned_album.gsub(album_info, '').strip
  end

  cleaned_album
end

#extraneous_album_infoObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/spotify/music/importer/album_name_cleaner.rb', line 19

def extraneous_album_info
  [
    '(Special Edition)',
    '(Deluxe Edition)',
    '(Deluxe Edition Remastered)',
    '(Remastered)',
    '(Canadian Version)',
    '(Non EU Version)',
    '(UK Version)',
    '(Brazilian Version)'
  ]
end