Class: Lita::DefaultConfiguration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/default_configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Builds the configuration object that is stored in each Registry.

Since:

  • 4.0.0

Constant Summary collapse

LOG_LEVELS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Valid levels for Lita’s logger.

Since:

  • 4.0.0

%w(debug info warn error fatal)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry) ⇒ DefaultConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DefaultConfiguration.

Parameters:

  • registry (Lita::Registry)

    The registry to build a default configuration object from.

Since:

  • 4.0.0



18
19
20
21
22
23
24
25
26
27
# File 'lib/lita/default_configuration.rb', line 18

def initialize(registry)
  @registry = registry
  @root = ConfigurationBuilder.new

  adapters_config
  handlers_config
  http_config
  redis_config
  robot_config
end

Instance Attribute Details

#registryLita::Registry (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A Registry to extract configuration for plugins from.

Returns:

Since:

  • 4.0.0



11
12
13
# File 'lib/lita/default_configuration.rb', line 11

def registry
  @registry
end

#rootLita::Configuration (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The top-level ConfigurationBuilder attribute.

Returns:

Since:

  • 4.0.0



15
16
17
# File 'lib/lita/default_configuration.rb', line 15

def root
  @root
end

Instance Method Details

#buildLita::Configuration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Processes the ConfigurationBuilder object to return a Configuration.

Returns:

Since:

  • 4.0.0



31
32
33
34
35
36
# File 'lib/lita/default_configuration.rb', line 31

def build
  final_config = root.build
  add_adapter_attribute(final_config)
  add_struct_access_to_redis(final_config.redis)
  final_config
end