Class: ThinkingSphinx::Callbacks
- Inherits:
-
Object
- Object
- ThinkingSphinx::Callbacks
- Defined in:
- lib/thinking_sphinx/callbacks.rb
Direct Known Subclasses
ActiveRecord::Callbacks::DeleteCallbacks, ActiveRecord::Callbacks::DeltaCallbacks, ActiveRecord::Callbacks::UpdateCallbacks
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(instance) ⇒ Callbacks
constructor
A new instance of Callbacks.
Constructor Details
#initialize(instance) ⇒ Callbacks
Returns a new instance of Callbacks.
12 13 14 |
# File 'lib/thinking_sphinx/callbacks.rb', line 12 def initialize(instance) @instance = instance end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
2 3 4 |
# File 'lib/thinking_sphinx/callbacks.rb', line 2 def instance @instance end |
Class Method Details
.callbacks(*methods) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/thinking_sphinx/callbacks.rb', line 4 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 |