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

- (Callbacks) initialize(instance)



12
13
14
# File 'lib/thinking_sphinx/callbacks.rb', line 12

def initialize(instance)
  @instance = instance
end

Instance Attribute Details

- (Object) instance (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

+ (Object) callbacks(*methods)



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