Class: ThinkingSphinx::Subscribers::PopulatorSubscriber
- Inherits:
-
Object
- Object
- ThinkingSphinx::Subscribers::PopulatorSubscriber
- Defined in:
- lib/thinking_sphinx/subscribers/populator_subscriber.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(message, *args) ⇒ Object
- #finish_populating(event) ⇒ Object
- #populated(event) ⇒ Object
- #start_populating(event) ⇒ Object
Class Method Details
.attach_to(namespace) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# 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 |
Instance Method Details
#call(message, *args) ⇒ Object
14 15 16 17 |
# File 'lib/thinking_sphinx/subscribers/populator_subscriber.rb', line 14 def call(, *args) send .split('.').first, ActiveSupport::Notifications::Event.new(, *args) end |
#finish_populating(event) ⇒ Object
27 28 29 |
# File 'lib/thinking_sphinx/subscribers/populator_subscriber.rb', line 27 def finish_populating(event) print "\n" end |
#populated(event) ⇒ Object
23 24 25 |
# File 'lib/thinking_sphinx/subscribers/populator_subscriber.rb', line 23 def populated(event) print '.' end |
#start_populating(event) ⇒ Object
19 20 21 |
# File 'lib/thinking_sphinx/subscribers/populator_subscriber.rb', line 19 def start_populating(event) puts "Generating index files for #{event.payload[:index].name}" end |