Class: Spotify::Music::Importer::TrackNameCleaner
- Inherits:
-
Object
- Object
- Spotify::Music::Importer::TrackNameCleaner
- Defined in:
- lib/spotify/music/importer/track_name_cleaner.rb
Instance Method Summary collapse
- #clean ⇒ Object
- #extraneous_track_info ⇒ Object
-
#initialize(track_name) ⇒ TrackNameCleaner
constructor
A new instance of TrackNameCleaner.
Constructor Details
#initialize(track_name) ⇒ TrackNameCleaner
Returns a new instance of TrackNameCleaner.
5 6 7 |
# File 'lib/spotify/music/importer/track_name_cleaner.rb', line 5 def initialize(track_name) @track_name = track_name end |
Instance Method Details
#clean ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/spotify/music/importer/track_name_cleaner.rb', line 9 def clean cleaned_track = @track_name extraneous_track_info.each do |track_info| cleaned_track = cleaned_track.gsub(track_info, '').strip end cleaned_track end |
#extraneous_track_info ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/spotify/music/importer/track_name_cleaner.rb', line 19 def extraneous_track_info [ '- Remastered', '- Single', '(Clean Album Version) (Clean)', '(Album Version)', '(Amended Album Version)', '(Explicit Album Version)' ] end |