Class: Chroma::ChromaConfiguration
- Inherits:
-
Object
- Object
- Chroma::ChromaConfiguration
- Defined in:
- lib/chroma/chroma_configuration.rb
Overview
The ChromaConfiguration class allows you to configure the connection settings for a Chroma service client. It can be initialized directly calling #new method.
Examples
configuration = Chroma::ChromaConfiguration.new
configurarion.connect_host = "https://chroma.example.com"
Or via a setup block.
Examples
Chroma::ChromaConfiguration.setup do |config|
config.connect_host = "https://chroma.example.com"
end
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Sets the base path for the Chroma API.
-
#api_version ⇒ Object
Sets the version of the Chroma API.
-
#connect_host ⇒ Object
Sets the host name for the Chroma service.
-
#log_level ⇒ Object
Sets the logger’s log level for the Chroma service client.
-
#logger ⇒ Object
Sets the logger for the Chroma service client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ChromaConfiguration
constructor
A new instance of ChromaConfiguration.
Constructor Details
#initialize ⇒ ChromaConfiguration
Returns a new instance of ChromaConfiguration.
68 69 70 71 72 73 |
# File 'lib/chroma/chroma_configuration.rb', line 68 def initialize @api_base = "api" @api_version = "v1" @log_level = Chroma::LEVEL_INFO end |
Instance Attribute Details
#api_base ⇒ Object
Sets the base path for the Chroma API.
Examples
config.api_base = "/api"
Returns the String API base path.
36 37 38 |
# File 'lib/chroma/chroma_configuration.rb', line 36 def api_base @api_base end |
#api_version ⇒ Object
Sets the version of the Chroma API.
Examples
config.api_version = "v1"
Returns the String API version.
44 45 46 |
# File 'lib/chroma/chroma_configuration.rb', line 44 def api_version @api_version end |
#connect_host ⇒ Object
Sets the host name for the Chroma service.
Examples
config.connect_host = "chroma.example.com"
Returns the String host name.
27 28 29 |
# File 'lib/chroma/chroma_configuration.rb', line 27 def connect_host @connect_host end |
#log_level ⇒ Object
Sets the logger’s log level for the Chroma service client.
Examples
config.log_level = Chroma::LEVEL_INFO
Returns the log level constant
60 61 62 |
# File 'lib/chroma/chroma_configuration.rb', line 60 def log_level @log_level end |
#logger ⇒ Object
Sets the logger for the Chroma service client.
Examples
config.logger = Logger.new(STDOUT)
Returns the Logger instance.
52 53 54 |
# File 'lib/chroma/chroma_configuration.rb', line 52 def logger @logger end |
Class Method Details
.setup ⇒ Object
62 63 64 65 66 |
# File 'lib/chroma/chroma_configuration.rb', line 62 def self.setup new.tap do |instance| yield(instance) if block_given? end end |