Class: ClickHouse::Config
- Inherits:
-
Object
- Object
- ClickHouse::Config
- Defined in:
- lib/click_house/config.rb
Constant Summary collapse
- DEFAULTS =
{ adapter: Faraday.default_adapter, url: nil, scheme: 'http', host: 'localhost', port: '8123', logger: nil, database: nil, username: nil, password: nil, timeout: nil, open_timeout: nil, ssl_verify: false, headers: {} }.freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#database ⇒ Object
Returns the value of attribute database.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #assign(params = {}) ⇒ self
- #auth? ⇒ Boolean
-
#initialize(params = {}) {|_self| ... } ⇒ Config
constructor
A new instance of Config.
- #logger! ⇒ Object
- #null_logger ⇒ Object
- #url! ⇒ Object
Constructor Details
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
21 22 23 |
# File 'lib/click_house/config.rb', line 21 def adapter @adapter end |
#database ⇒ Object
Returns the value of attribute database.
26 27 28 |
# File 'lib/click_house/config.rb', line 26 def database @database end |
#headers ⇒ Object
Returns the value of attribute headers.
33 34 35 |
# File 'lib/click_house/config.rb', line 33 def headers @headers end |
#host ⇒ Object
Returns the value of attribute host.
24 25 26 |
# File 'lib/click_house/config.rb', line 24 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
22 23 24 |
# File 'lib/click_house/config.rb', line 22 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
31 32 33 |
# File 'lib/click_house/config.rb', line 31 def open_timeout @open_timeout end |
#password ⇒ Object
Returns the value of attribute password.
29 30 31 |
# File 'lib/click_house/config.rb', line 29 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
25 26 27 |
# File 'lib/click_house/config.rb', line 25 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
23 24 25 |
# File 'lib/click_house/config.rb', line 23 def scheme @scheme end |
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
32 33 34 |
# File 'lib/click_house/config.rb', line 32 def ssl_verify @ssl_verify end |
#timeout ⇒ Object
Returns the value of attribute timeout.
30 31 32 |
# File 'lib/click_house/config.rb', line 30 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
27 28 29 |
# File 'lib/click_house/config.rb', line 27 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
28 29 30 |
# File 'lib/click_house/config.rb', line 28 def username @username end |
Instance Method Details
#assign(params = {}) ⇒ self
41 42 43 44 45 |
# File 'lib/click_house/config.rb', line 41 def assign(params = {}) params.each { |k, v| public_send("#{k}=", v) } self end |
#auth? ⇒ Boolean
47 48 49 |
# File 'lib/click_house/config.rb', line 47 def auth? !username.nil? || !password.nil? end |
#logger! ⇒ Object
51 52 53 |
# File 'lib/click_house/config.rb', line 51 def logger! @logger || null_logger end |
#null_logger ⇒ Object
59 60 61 |
# File 'lib/click_house/config.rb', line 59 def null_logger @null_logger ||= Logger.new(IO::NULL) end |
#url! ⇒ Object
55 56 57 |
# File 'lib/click_house/config.rb', line 55 def url! @url || "#{scheme}://#{host}:#{port}" end |