Class: Playa::TrackCollection
- Inherits:
-
Object
- Object
- Playa::TrackCollection
- Defined in:
- lib/playa/models/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.
3 4 5 |
# File 'lib/playa/models/track_collection.rb', line 3 def initialize(args = []) @args = args end |
Instance Method Details
#files ⇒ Object
14 15 16 17 18 |
# File 'lib/playa/models/track_collection.rb', line 14 def files @_files ||= Dir.glob(recursive).select do |file| File.file?(file) && File.extname(file) == '.mp3' end end |
#tracks ⇒ Object
7 8 9 10 11 12 |
# File 'lib/playa/models/track_collection.rb', line 7 def tracks @_tracks ||= files.reduce([]) do |acc, file| acc << Track.new(file) acc end end |