Module: ThinkingSphinx::Ports

Defined in:
lib/thinking_sphinx/ports.rb

Constant Summary collapse

PATH =
File.expand_path '~/.thinking_sphinx_ports.yml'

Class Method Summary collapse

Class Method Details

.call(key, collection = nil, configuration = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/thinking_sphinx/ports.rb', line 8

def self.call(key, collection = nil, configuration = nil)
  collection    ||= default_collection
  configuration ||= ThinkingSphinx::Configuration.instance

  port = collection.call key

  configuration.settings['mysql41'] = port
  configuration.searchd.mysql41     = port
end

.default_collectionObject



18
19
20
21
22
# File 'lib/thinking_sphinx/ports.rb', line 18

def self.default_collection
  @@default_collection ||= begin
    Collection.new Read.new(PATH), Write.new(PATH)
  end
end