Class: ThinkingSphinx::Callbacks

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/callbacks.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#instanceObject (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