Sha256: 28bd68e8c778628140c946054eb06fd81daf0ff827a8789599760893d44600aa
Contents?: true
Size: 734 Bytes
Versions: 7
Compression:
Stored size: 734 Bytes
Contents
class ThinkingSphinx::Subscribers::PopulatorSubscriber 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 def call(message, *args) send message.split('.').first, ActiveSupport::Notifications::Event.new(message, *args) end def start_populating(event) puts "Generating index files for #{event.payload[:index].name}" end def populated(event) print '.' end def finish_populating(event) print "\n" end end ThinkingSphinx::Subscribers::PopulatorSubscriber.attach_to( 'thinking_sphinx.real_time' )
Version data entries
7 entries across 7 versions & 1 rubygems