rom-rb/rom

Improve Plugin API

solnic opened this issue · 0 comments

Plugin API hard-codes support for core components (relations, schemas, commands and mappers) and there's no way to register a new component. This means that external components, like changeset, repository or anything else that may exist, have no way to use the plugin API.

Examples

# register a new component in the Plugin API

# using default plugin type
ROM::Plugins.register(:repository)

# using a custom plugin type
ROM::Plugins.register(:repository, ROM::Repository::RepositoryPlugin)

# now we can do
ROM.plugins do
  adapter :sql do
    register :my_repo_plugin, MyRepoPlugin, type: :repository
  end
end