Class: Hearken::Indexing::Indexer

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/hearken/indexing/indexer.rb

Instance Attribute Summary

Attributes included from Paths

#base_path, #index_path

Instance Method Summary collapse

Methods included from Paths

#create_paths, #in_base_dir

Constructor Details

#initialize(path) ⇒ Indexer

Returns a new instance of Indexer.



11
12
13
14
# File 'lib/hearken/indexing/indexer.rb', line 11

def initialize(path)
  create_paths
  @path = path
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/hearken/indexing/indexer.rb', line 16

def execute
  start = Time.now
  count = 0
  traverser = Hearken::Indexing::PersistantTraverser.new @path, index_path

  traverser.each do |_audio_file|
    count += 1
    show_progress start, count if (count % 1000).zero?
  end

  show_progress start, count

  system "afplay #{File.dirname(__FILE__)}/../../../media/applause.mp3"
end