Class: Tire::Configuration

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

Class Method Summary collapse

Class Method Details

.client(klass = nil) ⇒ Object


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

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

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


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

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

.pretty(value = nil, options = {}) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/tire/configuration.rb', line 22

def self.pretty(value=nil, options={})
  if value === false
    return @pretty = false
  else
    @pretty.nil? ? true : @pretty
  end
end

.reset(*properties) ⇒ Object


30
31
32
33
34
# File 'lib/tire/configuration.rb', line 30

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

.url(value = nil) ⇒ Object


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

def self.url(value=nil)
  @url = (value ? value.to_s.gsub(%r|/*$|, '') : nil) || @url || ENV['ELASTICSEARCH_URL'] || "http://localhost:9200"
end

.wrapper(klass = nil) ⇒ Object


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

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