Class: Playa::TrackCollection
- Inherits:
-
Object
- Object
- Playa::TrackCollection
- Defined in:
- lib/playa/track_collection.rb
Instance Method Summary collapse
- #files ⇒ Object
-
#initialize(args = []) ⇒ TrackCollection
constructor
A new instance of TrackCollection.
- #tracks ⇒ Object
Constructor Details
#initialize(args = []) ⇒ TrackCollection
Returns a new instance of TrackCollection.
5 6 7 |
# File 'lib/playa/track_collection.rb', line 5 def initialize(args = []) @args = args end |
Instance Method Details
#files ⇒ Object
16 17 18 19 20 |
# File 'lib/playa/track_collection.rb', line 16 def files @_files ||= Dir.glob(recursive).select do |file| File.file?(file) && File.extname(file) == '.mp3' end end |
#tracks ⇒ Object
9 10 11 12 13 14 |
# File 'lib/playa/track_collection.rb', line 9 def tracks @_tracks ||= files.reduce([]) do |acc, file| acc << Track.new(file) acc end end |