Sha256: 0d1f96074543916f79c30de22b486ed892bf2a7cb8a1eddd08c6aec02a07979b
Contents?: true
Size: 1.07 KB
Versions: 10
Compression:
Stored size: 1.07 KB
Contents
module ROM module Global # plugin registration DSL # # @private class PluginDSL # Default options passed to plugin registration # # @return [Hash] # # @api private attr_reader :defaults # Plugin registry # # @return [PluginRegistry] # # @api private attr_reader :registry # @api private def initialize(registry, defaults = EMPTY_HASH, &block) @registry = registry @defaults = defaults instance_exec(&block) end # Register a plugin # # @param [Symbol] name of the plugin # @param [Module] mod to include # @param [Hash] options # # @api public def register(name, mod, options = EMPTY_HASH) registry.register(name, mod, defaults.merge(options)) end # Register plugins for a specific adapter # # @param [Symbol] type The adapter identifier # # @api public def adapter(type, &block) self.class.new(registry, adapter: type, &block) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems