module Mobility::Plugins
Plugins
allow modular customization of backends independent of the backend itself. They are enabled through {Mobility::Translations.plugins} (delegated to from {Mobility.configure}), which takes a block within which plugins can be declared in any order (dependencies will be resolved).
Plugin
for ActiveRecord
models. This plugin automatically requires activerecord related plugins, which are not actually “active” unless their base plugin (e.g. dirty for active_record_dirty) is also enabled.
Public Class Methods
load_plugin(name)
click to toggle source
@param [Symbol] name Name of plugin to load.
# File lib/mobility/plugins.rb, line 16 def load_plugin(name) return name if Module === name || name.nil? unless (plugin = @plugins[name]) require "mobility/plugins/#{name}" raise LoadError, "plugin #{name} did not register itself correctly in Mobility::Plugins" unless (plugin = @plugins[name]) end plugin end
lookup_name(plugin)
click to toggle source
register_plugin(name, plugin)
click to toggle source
# File lib/mobility/plugins.rb, line 31 def register_plugin(name, plugin) @plugins[name] = plugin @names[plugin] = name end