Plugin Separation/Integration using method_missing

I’m trying to implement a framework where I have a concept of ‘plugin
overlays’. They plug into an application which provides a well defined
external interface. The core of the plugin is a ‘service’ method that
potentially alters the applications state.

What I’m trying to achieve is to have the plugin run on ‘top-of’ the
application. Essentially, forward all unknown messages to the
Application as a fall-back (and fail there if needed).

I have some code attached which forms the basis of my current
implementation. Essentially use method_missing and forward messages to
the application.

As I understand, assignment to what looks can be a local variable in a
method will never go to method_missing, but instead create a local
variable. Alternatives for my case would be to explicitly create
mappings for these methods before hand, or explicitly call a method on

Is this a bad idea?

My goal is to cleanly separate out code into reusable ‘plugins’ that
still have full access to the application. Also, plugins must be
isolated from each other.

I know explicitly referring to the application instead of having things
‘fall-through’ is an option.

Conceptually I’m thinking of this as a scope chain of sorts. On access
to an variable or a method call, we look for it in the Plugin (and all
its parents), and then the Application (and all its parents).