Ravn::BDE::Bolt::

Component module

Constants

COMPONENT_PREFIX

Plugin API – specify where concrete components should be loaded from

Public Class Methods

extended( component )

Extension hook – add some common data structures to extending +component+s.

# File lib/ravn/bde/bolt/component.rb, line 28
def self::extended( component )
        super

        component.extend( Loggability )
        component.log_to( :ravn_bde )

        component.extend( Ravn::MethodUtilities )
        component.singleton_attr_accessor( :added_message_handlers )
        component.added_message_handlers = {}
end
find( name )

Find the component module with the specified name and return it. Raises a LoadError if no such component is found.

# File lib/ravn/bde/bolt/component.rb, line 42
def self::find( name )
        name = name.to_s
        return self.concrete_modules[ name ] ||= begin
                modname = "%s::%s" % [
                        self.name.sub( /::\w+$/, ''),
                        name.to_camelcase
                ]

                self.log.info "Loading %s component as %s" % [ name, modname ]

                require( COMPONENT_PREFIX + '/' + name )
                Object.const_get( modname )
        end
end

Public Instance Methods

concrete_modules()

Some thingies that get loaded

# File lib/ravn/bde/bolt/component.rb, line 23
singleton_attr_reader :concrete_modules

Extension Methods

↑ top

Public Instance Methods

add_message_handlers( mapping )

Add one or more message handlers from the given mapping to extended bolts. The mapping should be in the same form as the Ravn::BDE::Bolt::PHASE_METHODS.

# File lib/ravn/bde/bolt/component.rb, line 65
def add_message_handlers( mapping )
        self.added_message_handlers.replace( mapping )
end
apply( bolt_class, ** )

Apply the component to the specified bolt_class with the given options.

# File lib/ravn/bde/bolt/component.rb, line 71
def apply( bolt_class, ** )
        self.log.debug "Applying base component stuff from %p to %p" % [ self, bolt_class ]
        bolt_class.message_handler_map.merge!( self.added_message_handlers )

        if self.const_defined?( :ClassMethods )
                class_methods = self.const_get( :ClassMethods )
                bolt_class.extend( class_methods )
        end

        bolt_class.prepend( self )
end
validate( opts )

Provide an opportunity for concrete classes to verify and normalize their arguments.

# File lib/ravn/bde/bolt/component.rb, line 86
def validate( opts )
        return opts
end