Class: Musk::Decorator::PrintableTrack
- Inherits:
-
Object
- Object
- Musk::Decorator::PrintableTrack
- Defined in:
- lib/musk/decorator/printable_track.rb
Instance Method Summary collapse
- #artist ⇒ Object
- #comment ⇒ Object
- #genre ⇒ Object
-
#initialize(track) ⇒ PrintableTrack
constructor
A new instance of PrintableTrack.
- #number ⇒ Object
- #number_of ⇒ Object
- #path ⇒ Object
- #position ⇒ Object
- #release ⇒ Object
- #title ⇒ Object
- #year ⇒ Object
Constructor Details
#initialize(track) ⇒ PrintableTrack
Returns a new instance of PrintableTrack.
4 5 6 |
# File 'lib/musk/decorator/printable_track.rb', line 4 def initialize(track) @track = track end |
Instance Method Details
#artist ⇒ Object
36 37 38 |
# File 'lib/musk/decorator/printable_track.rb', line 36 def artist @track.artist or "-" end |
#comment ⇒ Object
28 29 30 |
# File 'lib/musk/decorator/printable_track.rb', line 28 def comment [nil, 0, "0"].include?(@track.comment) ? "-" : @track.comment end |
#genre ⇒ Object
44 45 46 |
# File 'lib/musk/decorator/printable_track.rb', line 44 def genre @track.genre or "-" end |
#number ⇒ Object
16 17 18 |
# File 'lib/musk/decorator/printable_track.rb', line 16 def number [nil, 0, "0"].include?(@track.number) ? "-" : @track.number end |
#number_of ⇒ Object
20 21 22 |
# File 'lib/musk/decorator/printable_track.rb', line 20 def number_of [nil, 0, "0"].include?(@track.number_of) ? "-" : @track.number_of end |
#path ⇒ Object
8 9 10 |
# File 'lib/musk/decorator/printable_track.rb', line 8 def path @track.fullpath.gsub(@track.loadpath, "") end |
#position ⇒ Object
12 13 14 |
# File 'lib/musk/decorator/printable_track.rb', line 12 def position "#{number}/#{number_of}" end |
#release ⇒ Object
40 41 42 |
# File 'lib/musk/decorator/printable_track.rb', line 40 def release @track.release or "-" end |
#title ⇒ Object
32 33 34 |
# File 'lib/musk/decorator/printable_track.rb', line 32 def title @track.title or "-" end |
#year ⇒ Object
24 25 26 |
# File 'lib/musk/decorator/printable_track.rb', line 24 def year [nil, 0, "0"].include?(@track.year) ? "-" : @track.year end |