Class: Slingshot::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/slingshot/configuration.rb

Class Method Summary collapse

Class Method Details

.client(klass = nil) ⇒ Object



9
10
11
# File 'lib/slingshot/configuration.rb', line 9

def self.client(klass=nil)
  @client = klass || @client || Client::RestClient
end

.logger(device = nil, options = {}) ⇒ Object



17
18
19
20
# File 'lib/slingshot/configuration.rb', line 17

def self.logger(device=nil, options={})
  return @logger = Logger.new(device, options) if device
  @logger || nil
end

.reset(*properties) ⇒ Object



22
23
24
25
# File 'lib/slingshot/configuration.rb', line 22

def self.reset(*properties)
  reset_variables = properties.empty? ? instance_variables : instance_variables & properties.map { |p| "@#{p}" }
  reset_variables.each { |v| instance_variable_set(v, nil) }
end

.url(value = nil) ⇒ Object



5
6
7
# File 'lib/slingshot/configuration.rb', line 5

def self.url(value=nil)
  @url    = value || @url || "http://localhost:9200"
end

.wrapper(klass = nil) ⇒ Object



13
14
15
# File 'lib/slingshot/configuration.rb', line 13

def self.wrapper(klass=nil)
  @wrapper = klass || @wrapper || Results::Item
end