Slide 52
Slide 52 text
Shrine Example (Ruby)
def plugin(plugin, *args, **kwargs, &block)
plugin = Plugins.load_plugin(plugin) if plugin.is_a?(Symbol)
Plugins.load_dependencies(plugin, self, *args, **kwargs, &block)
self.include(plugin::InstanceMethods) if defined?(plugin::InstanceMethods)
self.extend(plugin::ClassMethods) if defined?(plugin::ClassMethods)
self::UploadedFile.include(plugin::FileMethods) if defined?(plugin::FileMethods)
self::UploadedFile.extend(plugin::FileClassMethods) if defined?(plugin::FileClassMethods)
self::Attachment.include(plugin::AttachmentMethods) if defined?(plugin::AttachmentMethods)
self::Attachment.extend(plugin::AttachmentClassMethods) if defined?(plugin::AttachmentClassMethods)
self::Attacher.include(plugin::AttacherMethods) if defined?(plugin::AttacherMethods)
self::Attacher.extend(plugin::AttacherClassMethods) if defined?(plugin::AttacherClassMethods)
Plugins.configure(plugin, self, *args, **kwargs, &block)
plugin
end