10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/pathway.rb', line 10
def self.plugin(name, *args)
require "pathway/plugins/#{Inflector.underscore(name)}" if name.is_a?(Symbol)
plugin = name.is_a?(Module) ? name : Plugins.const_get(Inflector.camelize(name))
self.extend plugin::ClassMethods if plugin.const_defined? :ClassMethods
self.include plugin::InstanceMethods if plugin.const_defined? :InstanceMethods
self::DSL.include plugin::DSLMethods if plugin.const_defined? :DSLMethods
plugin.apply(self, *args) if plugin.respond_to?(:apply)
end
|