Trouble writing a plugin with view helpers


I am writing a plugin with some view helpers, and have hit a wall. The
helper method uses a class that specifies specific behavior depending
on an model object. The problem is that I need that class to be able
to use the rest of Rails helpers, such as content_tag.

The class extends a general class which is mixed with a module. It
uses method_missing to define methods to the class used by the helper
method if it hasn't been defined.

This is the code with the problem: