Rails plugins?

Hi everyone,

I’m trying to set up a plugin structure where I have a main module
(for argument’s sake called “Abc”), which I want to be able to access
in my controllers. So far, so good. I can invoke Abc.method_name
without difficulties.

The problems start once I the next part of my plugin: I want to extend
Abc with another module or class, either Foo or Bar, with a method
such as:


The code I currently have is:


module ABC
def self.choose_child(child)
require “children/” + child
send :include, child.constantize
ActionController::Base.send :include, SOAPHandler


module Foo
def self.foobar
return “hello from Foo”


module Bar
def self.foobar
return “hello from Bar”

Then, I want to be able to–in my controllers–do Abc.foobar, which
would return either “hello from Foo” or “hello from Bar” depending on
which one I loaded with choose_child.

This is the loose implementation, anyway–feel free to point out a
better structure.

Any help would be appreciated.

Best regards,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs