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



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

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

.reset(*properties) ⇒ Object



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

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

.timeout_sec(value = nil) ⇒ Object



24
25
26
# File 'lib/tire/configuration.rb', line 24

def self.timeout_sec(value=nil)
  @timeout_sec = value || @timeout_sec || 10
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['CSDNSEARCH_URL'] || "http://localhost:9200"
end