Module: SimpleMapper::PluginSupport::ClassMethods

Defined in:
lib/simple_mapper/plugin_support.rb

Instance Method Summary collapse

Instance Method Details

#include_plugin(plugin_name) ⇒ Object Also known as: has, uses, acts_as

Requires the plugin mentioned, then includes it in the calling class or module. The require step is rescued, so if you have your own plugin you can still use this to include your plugin after you’ve required it.



10
11
12
13
# File 'lib/simple_mapper/plugin_support.rb', line 10

def include_plugin(plugin_name)
  require "simple_mapper/default_plugins/#{plugin_name.to_s}" rescue nil
  include Object.module_eval("::SimpleMapper::#{plugin_name.to_s.camelize}", __FILE__, __LINE__)
end