Module: Oedipus::Connection::Registry
- Included in:
- Oedipus
- Defined in:
- lib/oedipus/connection/registry.rb
Instance Method Summary collapse
-
#connect(options, key = :default) ⇒ Connection
Connect to Sphinx running SphinxQL.
-
#connection(key = :default) ⇒ Connection
Lookup an already connected connection.
- #connections ⇒ Object
Instance Method Details
#connect(options, key = :default) ⇒ Connection
Connect to Sphinx running SphinxQL.
Connections are cached for re-use.
31 32 33 |
# File 'lib/oedipus/connection/registry.rb', line 31 def connect(, key = :default) connections[key] = Connection.new() end |
#connection(key = :default) ⇒ Connection
Lookup an already connected connection.
46 47 48 49 |
# File 'lib/oedipus/connection/registry.rb', line 46 def connection(key = :default) raise ArgumentError, "Connection #{key} is not defined" unless connections.key?(key) connections[key] end |
#connections ⇒ Object
51 52 53 |
# File 'lib/oedipus/connection/registry.rb', line 51 def connections @connections ||= {} end |