Class: Spotify::Music::Importer::CollectionRecord
- Inherits:
-
Object
- Object
- Spotify::Music::Importer::CollectionRecord
- Defined in:
- lib/spotify/music/importer/collection_record.rb
Instance Method Summary collapse
- #album ⇒ Object
- #artist ⇒ Object
-
#initialize(row, options = {}) ⇒ CollectionRecord
constructor
A new instance of CollectionRecord.
- #name ⇒ Object
- #to_json(options = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(row, options = {}) ⇒ CollectionRecord
Returns a new instance of CollectionRecord.
7 8 9 10 11 |
# File 'lib/spotify/music/importer/collection_record.rb', line 7 def initialize(row, = {}) @row = row @clean_album = .delete(:clean_album) { false } @clean_track = .delete(:clean_track) { false } end |
Instance Method Details
#album ⇒ Object
29 30 31 32 33 34 35 |
# 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 ⇒ Object
21 22 23 24 25 26 27 |
# 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 ⇒ Object
13 14 15 16 17 18 19 |
# 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 = {}) ⇒ Object
41 42 43 |
# File 'lib/spotify/music/importer/collection_record.rb', line 41 def to_json( = {}) { :name => name, :album => album, :artist => artist }.to_json() end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/spotify/music/importer/collection_record.rb', line 37 def to_s "Name: #{name} Album: #{album} Artist: #{artist}" end |