Advertisement
lagranzotto

Track.rb

Oct 7th, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.74 KB | None | 0 0
  1. class Track
  2.  
  3.     attr_accessor :tags,
  4.                   :bit_rate,
  5.                   :sample_rate,
  6.                   :track_number,
  7.                   :size,
  8.                   :time,
  9.                   :artist,
  10.                   :comments,
  11.                   :composer,
  12.                   :filename,
  13.                   :genre,
  14.                   :grouping,
  15.                   :title
  16.  
  17.     def initialize(song)
  18.         if song.instance_of? Song
  19.                 @artist = song.artist
  20.                 @bit_rate = song.bit_rate
  21.                 @comments = song.comments
  22.                 @composer = song.composer
  23.                 @filename = song.filename
  24.                 @genre = song.genre
  25.                 @grouping = song.grouping
  26.                 @title = song.title
  27.                 @sample_rate = song.sample_rate
  28.                 @size = song.size
  29.                 @time = song.time
  30.                 @track_number = song.track_number
  31.                 @tags = song.tags.reject!{ |k| k == :compilation }
  32.         end
  33.     end
  34.  
  35.     def to_s
  36.         self.inspect
  37.     end
  38.  
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement