Sha256: 2667e55f453bbe4fd63617cd6442f1b2475274daebb7f71abac1b8f6c789fded

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

module Lita
  # Mixin to add the ability for a plugin to define configuration.
  # @since 4.0.0
  # @api private
  module Configurable
    # The plugins's {Lita::ConfigurationBuilder} object.
    # @return [Lita::ConfigurationBuilder] The configuration builder.
    # @since 4.0.0
    attr_accessor :configuration_builder

    # Sets a configuration attribute on the plugin.
    # @return [void]
    # @since 4.0.0
    # @see Lita::ConfigurationBuilder#config
    def config(*args, **kwargs)
      if block_given?
        configuration_builder.config(*args, **kwargs, &proc)
      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

6 entries across 6 versions & 1 rubygems

Version Path
lita-4.0.4 lib/lita/configurable.rb
lita-4.0.3 lib/lita/configurable.rb
lita-4.0.2 lib/lita/configurable.rb
lita-4.0.1 lib/lita/configurable.rb
lita-4.0.0 lib/lita/configurable.rb
lita-4.0.0.rc2 lib/lita/configurable.rb