Module: Mobility::Plugins

Defined in:
lib/mobility/plugins.rb,
lib/mobility/plugins/arel.rb,
lib/mobility/plugins/cache.rb,
lib/mobility/plugins/dirty.rb,
lib/mobility/plugins/query.rb,
lib/mobility/plugins/reader.rb,
lib/mobility/plugins/sequel.rb,
lib/mobility/plugins/writer.rb,
lib/mobility/plugins/backend.rb,
lib/mobility/plugins/default.rb,
lib/mobility/plugins/presence.rb,
lib/mobility/plugins/fallbacks.rb,
lib/mobility/plugins/arel/nodes.rb,
lib/mobility/plugins/attributes.rb,
lib/mobility/plugins/active_model.rb,
lib/mobility/plugins/sequel/cache.rb,
lib/mobility/plugins/sequel/dirty.rb,
lib/mobility/plugins/sequel/query.rb,
lib/mobility/plugins/active_record.rb,
lib/mobility/plugins/backend_reader.rb,
lib/mobility/plugins/sequel/backend.rb,
lib/mobility/plugins/column_fallback.rb,
lib/mobility/plugins/locale_accessors.rb,
lib/mobility/plugins/arel/nodes/pg_ops.rb,
lib/mobility/plugins/attribute_methods.rb,
lib/mobility/plugins/active_model/cache.rb,
lib/mobility/plugins/active_model/dirty.rb,
lib/mobility/plugins/active_record/cache.rb,
lib/mobility/plugins/active_record/dirty.rb,
lib/mobility/plugins/active_record/query.rb,
lib/mobility/plugins/active_record/backend.rb,
lib/mobility/plugins/fallthrough_accessors.rb,
lib/mobility/plugins/sequel/column_fallback.rb,
lib/mobility/plugins/active_record/column_fallback.rb,
lib/mobility/plugins/active_record/uniqueness_validation.rb

Overview

Plugin to use an original column for a given locale, and otherwise use the backend.

Defined Under Namespace

Modules: ActiveModel, ActiveRecord, Arel, AttributeMethods, Attributes, Backend, BackendReader, Cache, ColumnFallback, Default, Dirty, Fallbacks, FallthroughAccessors, LocaleAccessors, Presence, Query, Reader, Sequel, Writer Classes: LoadError

Class Method Summary collapse

Class Method Details

.load_plugin(name) ⇒ Object

Parameters:

  • name (Symbol)

    Name of plugin to load.



16
17
18
19
20
21
22
23
24
# 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) ⇒ Object

Parameters:

  • plugin (Module)

    Plugin module to lookup. Plugin must already be loaded.



27
28
29
# File 'lib/mobility/plugins.rb', line 27

def lookup_name(plugin)
  @names.fetch(plugin)
end

.register_plugin(name, plugin) ⇒ Object



31
32
33
34
# File 'lib/mobility/plugins.rb', line 31

def register_plugin(name, plugin)
  @plugins[name] = plugin
  @names[plugin] = name
end