class ThinkingSphinx::Subscribers::PopulatorSubscriber
Public Class Methods
attach_to(namespace)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 4 def self.attach_to(namespace) subscriber = new subscriber.public_methods(false).each do |event| next if event == :call ActiveSupport::Notifications.subscribe( "#{event}.#{namespace}", subscriber ) end end
Public Instance Methods
call(message, *args)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 16 def call(message, *args) send message.split('.').first, ActiveSupport::Notifications::Event.new(message, *args) end
error(event)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 21 def error(event) error = event.payload[:error].inner_exception instance = event.payload[:error].instance puts <<-MESSAGE Error transcribing #{instance.class} #{instance.id}: #{error.message} MESSAGE end
finish_populating(event)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 40 def finish_populating(event) print "\n" end
populated(event)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 36 def populated(event) print '.' * event.payload[:instances].length end
start_populating(event)
click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 32 def start_populating(event) puts "Generating index files for #{event.payload[:index].name}" end