class ThinkingSphinx::Callbacks

Attributes

instance[R]

Public Class Methods

append(model, reference = nil, options, &block) click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 6
def self.append(model, reference = nil, options, &block)
  reference ||= ThinkingSphinx::Configuration.instance.index_set_class.
    reference_name(model)

  ThinkingSphinx::Callbacks::Appender.call(model, reference, options, &block)
end
callbacks(*methods) click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 13
def self.callbacks(*methods)
  mod = Module.new
  methods.each do |method|
    mod.send(:define_method, method) { |instance| new(instance).send(method) }
  end
  extend mod
end
new(instance) click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 39
def initialize(instance)
  @instance = instance
end
resume!() click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 21
def self.resume!
  @suspended = false
end
suspend() { || ... } click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 25
def self.suspend(&block)
  suspend!
  yield
  resume!
end
suspend!() click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 31
def self.suspend!
  @suspended = true
end
suspended?() click to toggle source
# File lib/thinking_sphinx/callbacks.rb, line 35
def self.suspended?
  @suspended
end