Sha256: 41bb4c8fb40cce2ce9862e60f0fae3f8f42b5b983ea8510344bb971e8ea1118a
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require_relative "configuration_builder" module Lita # Mixin to add the ability for a plugin to define configuration. # @since 4.0.0 module Configurable # A block to be executed after configuration is finalized. # @return [#call, nil] The block. # @since 5.0.0 # @api private attr_accessor :after_config_block # The plugins's {ConfigurationBuilder} object. # @return [ConfigurationBuilder] The configuration builder. # @since 4.0.0 # @api public attr_accessor :configuration_builder # Registers a block to be executed after configuration is finalized. # @yieldparam config [Configuration] The handler's configuration object. # @return [void] # @since 5.0.0 def after_config(&block) self.after_config_block = block end # Sets a configuration attribute on the plugin. # @return [void] # @since 4.0.0 # @see ConfigurationBuilder#config def config(*args, **kwargs, &block) if block configuration_builder.config(*args, **kwargs, &block) else configuration_builder.config(*args, **kwargs) end end # Initializes the configuration builder for any inheriting classes. def inherited(klass) super klass.configuration_builder = ConfigurationBuilder.new end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rita-5.0.0.alpha.4 | lib/lita/configurable.rb |
rita-5.0.0.alpha.3 | lib/lita/configurable.rb |
rita-5.0.0.alpha.2 | lib/lita/configurable.rb |
rita-5.0.0.alpha.1 | lib/lita/configurable.rb |