Class: ThinkingSphinx::Callbacks
- Inherits:
-
Object
- Object
- ThinkingSphinx::Callbacks
show all
- Defined in:
- lib/thinking_sphinx/callbacks.rb
Defined Under Namespace
Classes: Appender
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(instance) ⇒ Callbacks
Returns a new instance of Callbacks.
39
40
41
|
# File 'lib/thinking_sphinx/callbacks.rb', line 39
def initialize(instance)
@instance = instance
end
|
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
4
5
6
|
# File 'lib/thinking_sphinx/callbacks.rb', line 4
def instance
@instance
end
|
Class Method Details
.append(model, reference = nil, options, &block) ⇒ Object
.callbacks(*methods) ⇒ Object
13
14
15
16
17
18
19
|
# 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
|
.resume! ⇒ Object
21
22
23
|
# File 'lib/thinking_sphinx/callbacks.rb', line 21
def self.resume!
@suspended = false
end
|
.suspend(&block) ⇒ Object
25
26
27
28
29
|
# File 'lib/thinking_sphinx/callbacks.rb', line 25
def self.suspend(&block)
suspend!
yield
resume!
end
|
.suspend! ⇒ Object
31
32
33
|
# File 'lib/thinking_sphinx/callbacks.rb', line 31
def self.suspend!
@suspended = true
end
|
.suspended? ⇒ Boolean
35
36
37
|
# File 'lib/thinking_sphinx/callbacks.rb', line 35
def self.suspended?
@suspended
end
|