Class: ThinkingSphinx::Index

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference, options, &block) ⇒ Index

Returns a new instance of Index.



12
13
14
15
16
17
18
# File 'lib/thinking_sphinx/index.rb', line 12

def initialize(reference, options, &block)
  defaults = ThinkingSphinx::Configuration.instance.
    settings['index_options'] || {}
  defaults.symbolize_keys!

  @reference, @options, @block = reference, defaults.merge(options), block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



4
5
6
# File 'lib/thinking_sphinx/index.rb', line 4

def block
  @block
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/thinking_sphinx/index.rb', line 4

def options
  @options
end

#referenceObject (readonly)

Returns the value of attribute reference.



4
5
6
# File 'lib/thinking_sphinx/index.rb', line 4

def reference
  @reference
end

Class Method Details

.define(reference, options = {}, &block) ⇒ Object



6
7
8
9
10
# File 'lib/thinking_sphinx/index.rb', line 6

def self.define(reference, options = {}, &block)
  new(reference, options, &block).indices.each do |index|
    ThinkingSphinx::Configuration.instance.indices << index
  end
end

Instance Method Details

#indicesObject



20
21
22
# File 'lib/thinking_sphinx/index.rb', line 20

def indices
  options[:delta] ? delta_indices : [single_index]
end