Class: ClickHouse::Config
- Inherits:
-
Object
- Object
- ClickHouse::Config
- Defined in:
- lib/click_house/config.rb
Constant Summary collapse
- DEFAULT_SCHEME =
'http'
- DEFAULT_HOST =
'localhost'
- DEFAULT_PORT =
'8123'
- 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 }.freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#database ⇒ Object
Returns the value of attribute database.
-
#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
- #url! ⇒ Object
Constructor Details
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
24 25 26 |
# File 'lib/click_house/config.rb', line 24 def adapter @adapter end |
#database ⇒ Object
Returns the value of attribute database.
29 30 31 |
# File 'lib/click_house/config.rb', line 29 def database @database end |
#host ⇒ Object
Returns the value of attribute host.
27 28 29 |
# File 'lib/click_house/config.rb', line 27 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
25 26 27 |
# File 'lib/click_house/config.rb', line 25 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
34 35 36 |
# File 'lib/click_house/config.rb', line 34 def open_timeout @open_timeout end |
#password ⇒ Object
Returns the value of attribute password.
32 33 34 |
# File 'lib/click_house/config.rb', line 32 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
28 29 30 |
# File 'lib/click_house/config.rb', line 28 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
26 27 28 |
# File 'lib/click_house/config.rb', line 26 def scheme @scheme end |
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
35 36 37 |
# File 'lib/click_house/config.rb', line 35 def ssl_verify @ssl_verify end |
#timeout ⇒ Object
Returns the value of attribute timeout.
33 34 35 |
# File 'lib/click_house/config.rb', line 33 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
30 31 32 |
# File 'lib/click_house/config.rb', line 30 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
31 32 33 |
# File 'lib/click_house/config.rb', line 31 def username @username end |
Instance Method Details
#assign(params = {}) ⇒ self
43 44 45 46 47 |
# File 'lib/click_house/config.rb', line 43 def assign(params = {}) params.each { |k, v| public_send("#{k}=", v) } self end |
#auth? ⇒ Boolean
49 50 51 |
# File 'lib/click_house/config.rb', line 49 def auth? !username.nil? || !password.nil? end |
#logger! ⇒ Object
53 54 55 |
# File 'lib/click_house/config.rb', line 53 def logger! @logger || Logger.new('/dev/null') end |
#url! ⇒ Object
57 58 59 |
# File 'lib/click_house/config.rb', line 57 def url! @url || "#{scheme}://#{host}:#{port}" end |