Class: Tire::Configuration
- Inherits:
-
Object
- Object
- Tire::Configuration
- Defined in:
- lib/tire/configuration.rb
Class Method Summary collapse
- .client(klass = nil) ⇒ Object
- .logger(device = nil, options = {}) ⇒ Object
- .pretty(value = nil, options = {}) ⇒ Object
- .reset(*properties) ⇒ Object
- .url(value = nil) ⇒ Object
- .wrapper(klass = nil) ⇒ Object
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, ={}) return @logger = Logger.new(device, ) 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, ={}) 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 |