Class: Spot::Song
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#territory ⇒ Object
writeonly
Sets the attribute territory.
Attributes inherited from Base
Instance Method Summary collapse
- #album ⇒ Object
- #artist ⇒ Object
- #to_s ⇒ Object
-
#valid? ⇒ Boolean
Is valid if the territory exists or if no territory is given.
Methods inherited from Base
#available?, #href, #initialize, #popularity
Constructor Details
This class inherits a constructor from Spot::Base
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
5 6 7 |
# File 'lib/spot/song.rb', line 5 def length @length end |
#territory=(value) ⇒ Object (writeonly)
Sets the attribute territory
6 7 8 |
# File 'lib/spot/song.rb', line 6 def territory=(value) @territory = value end |
Instance Method Details
#album ⇒ Object
17 18 19 |
# File 'lib/spot/song.rb', line 17 def album @_album ||= Spot::Album.new(@album) end |
#artist ⇒ Object
13 14 15 |
# File 'lib/spot/song.rb', line 13 def artist @_artist ||= Spot::Artist.new(@artists.first) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/spot/song.rb', line 21 def to_s "#{artist.name} - #{title}" end |
#valid? ⇒ Boolean
Is valid if the territory exists or if no territory is given
9 10 11 |
# File 'lib/spot/song.rb', line 9 def valid? available?(@territory) or !@territory end |