Sha256: 23c334777a193c2547c32ce43329300d10975c1c24263792b64d52948405df99

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

require 'pathname'
require 'hearken/indexing/file'

class Hearken::Indexing::AudioTraverser
  attr_reader :current
  EXTS = %w{m4a mp3 ogg wma flac aac}.map {|e| '.'+e }

  def initialize path
    @path = Pathname.new path
  end

  def each
    @path.find { |child| yield Hearken::Indexing::File.new child, @path if is_audio? child }
  end
private
  def is_audio? current
    current.file? and EXTS.include? current.extname.downcase
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hearken-0.1.3 lib/hearken/indexing/audio_traverser.rb
hearken-0.1.2 lib/hearken/indexing/audio_traverser.rb
hearken-0.1.1 lib/hearken/indexing/audio_traverser.rb