class ThinkingSphinx::Subscribers::PopulatorSubscriber

Public Class Methods

attach_to(namespace) click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 2
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 14
def call(message, *args)
  send message.split('.').first,
    ActiveSupport::Notifications::Event.new(message, *args)
end
finish_populating(event) click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 27
def finish_populating(event)
  print "\n"
end
populated(event) click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 23
def populated(event)
  print '.'
end
start_populating(event) click to toggle source
# File lib/thinking_sphinx/subscribers/populator_subscriber.rb, line 19
def start_populating(event)
  puts "Generating index files for #{event.payload[:index].name}"
end