Class: Solrsam::Config
- Inherits:
-
Object
- Object
- Solrsam::Config
- Includes:
- Singleton
- Defined in:
- lib/solrsam/config.rb
Instance Method Summary collapse
- #add_server(namespace, url, method) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #rsolr_object(namespace = :default, method = :read) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 |
# File 'lib/solrsam/config.rb', line 5 def initialize @server_urls = { :write => {}, :read => {} } @solr_servers = { :write => {}, :read => {} } end |
Instance Method Details
#add_server(namespace, url, method) ⇒ Object
19 20 21 22 23 |
# File 'lib/solrsam/config.rb', line 19 def add_server(namespace, url, method) @server_urls[method][namespace] = url end |
#rsolr_object(namespace = :default, method = :read) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/solrsam/config.rb', line 10 def rsolr_object(namespace = :default, method = :read) unless @solr_servers[method][namespace] @solr_servers[method][namespace] = RSolr.connect :url => @server_urls[method][namespace] end @solr_servers[method][namespace] end |