Class: Nehm::Artwork
- Inherits:
-
Object
- Object
- Nehm::Artwork
- Defined in:
- lib/nehm/artwork.rb
Overview
Artwork objects contains all information of track’s artwork
Instance Method Summary collapse
- #file_path ⇒ Object
-
#initialize(track) ⇒ Artwork
constructor
A new instance of Artwork.
- #suicide ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(track) ⇒ Artwork
Returns a new instance of Artwork.
8 9 10 |
# File 'lib/nehm/artwork.rb', line 8 def initialize(track) @track = track end |
Instance Method Details
#file_path ⇒ Object
12 13 14 |
# File 'lib/nehm/artwork.rb', line 12 def file_path File.join('/tmp', "#{@track.id}.jpg") end |
#suicide ⇒ Object
16 17 18 |
# File 'lib/nehm/artwork.rb', line 16 def suicide File.delete(file_path) end |
#url ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nehm/artwork.rb', line 20 def url hash = @track.hash url = if hash['artwork_url'].nil? hash['user']['avatar_url'] else hash['artwork_url'] end url.sub('large', 't500x500') end |