Class: Influxdb::Api::Configuration
- Inherits:
-
Object
- Object
- Influxdb::Api::Configuration
- Defined in:
- lib/influxdb/api/configuration.rb
Defined Under Namespace
Classes: Host
Constant Summary collapse
- DEFAULT_LOGGER =
->{ require 'logger' logger = Logger.new(STDERR) logger.progname = 'influxdb' logger.formatter = ->(severity, datetime, progname, msg){ "#{datetime}: #{msg}\n" } logger }
Instance Attribute Summary collapse
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#log ⇒ Object
Returns the value of attribute log.
- #logger ⇒ Object
-
#password ⇒ Object
Returns the value of attribute password.
-
#resurrect_timeout ⇒ Object
Returns the value of attribute resurrect_timeout.
-
#retry_on_failure ⇒ Object
Returns the value of attribute retry_on_failure.
-
#selector ⇒ Object
Returns the value of attribute selector.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #connection_block(&block) ⇒ Object
- #dup ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/influxdb/api/configuration.rb', line 74 def initialize @log = false @user = 'root' @password = 'root' @serializer = MultiJson = {} @connection_block = nil @retry_on_failure = false @resurrect_timeout = 60 @hosts = Host::DEFAULT @selector = Client::Selector::RoundRobin.new end |
Instance Attribute Details
#connection_options ⇒ Object
Returns the value of attribute connection_options.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def end |
#hosts ⇒ Object
Returns the value of attribute hosts.
8 9 10 |
# File 'lib/influxdb/api/configuration.rb', line 8 def hosts @hosts end |
#log ⇒ Object
Returns the value of attribute log.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def log @log end |
#logger ⇒ Object
87 88 89 |
# File 'lib/influxdb/api/configuration.rb', line 87 def logger @logger ||= log ? DEFAULT_LOGGER.call : nil end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def password @password end |
#resurrect_timeout ⇒ Object
Returns the value of attribute resurrect_timeout.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def resurrect_timeout @resurrect_timeout end |
#retry_on_failure ⇒ Object
Returns the value of attribute retry_on_failure.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def retry_on_failure @retry_on_failure end |
#selector ⇒ Object
Returns the value of attribute selector.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def selector @selector end |
#serializer ⇒ Object
Returns the value of attribute serializer.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def serializer @serializer end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/influxdb/api/configuration.rb', line 4 def user @user end |
Instance Method Details
#connection_block(&block) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/influxdb/api/configuration.rb', line 95 def connection_block(&block) if block_given? @connection_block = block else @connection_block end end |
#dup ⇒ Object
103 104 105 106 107 |
# File 'lib/influxdb/api/configuration.rb', line 103 def dup clone = super clone. = .dup clone end |