Class: Lita::PluginBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/plugin_builder.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.

Constructs a Lita plugin from a block.

Since:

  • 4.0.0

Instance Method Summary collapse

Constructor Details

#initialize(namespace) { ... } ⇒ PluginBuilder

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 PluginBuilder.

Parameters:

  • namespace (String, Symbol)

    The Redis namespace to use for the plugin.

Yields:

  • The class body of the plugin.

Since:

  • 4.0.0



8
9
10
11
# File 'lib/lita/plugin_builder.rb', line 8

def initialize(namespace, &block)
  @namespace = namespace.to_s
  @block = block
end

Instance Method Details

#build_adapterLita::Adapter

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.

Constructs an Adapter from the provided block.

Returns:

Since:

  • 4.0.0



15
16
17
18
19
# File 'lib/lita/plugin_builder.rb', line 15

def build_adapter
  adapter = create_plugin(Adapter)
  adapter.class_exec(&@block)
  adapter
end

#build_handlerLita::Handler

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.

Constructs a Handler from the provided block.

Returns:

Since:

  • 4.0.0



23
24
25
26
27
# File 'lib/lita/plugin_builder.rb', line 23

def build_handler
  handler = create_plugin(Handler)
  handler.class_exec(&@block)
  handler
end