Class: Playa::TrackCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/playa/track_collection.rb

Instance Method Summary collapse

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

#filesObject



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

#tracksObject



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