On Mon, Apr 29, 2013 at 10:45:57AM -0700, Bill Moseley wrote:
> What we are after is somewhat of a plugin system built with Roles where a
> method in each Role is called in some defined order and once successful no
> more are run.
> Anyone have a better suggestion than our "before authenticate" approach?

(in principle) roles should be able to be applied in any order and not be
aware of/care about what other roles have been applied.  If you need method
modifiers to be aware of each other's existence, I would suggest creating
an attribute (via another role, that the other roles would 'requires' to be
applied) which can share the necessary state information.

Altneratively, you might find the augment/inner method modification pattern
to be of use -- a method can always opt to not call inner() if it has had
its preconditions satisfied already.  (Actually, this is probably better
than my first suggestion.)



-- 
                  Love is grand, divorce is a hundred grand.
            .             .            .            .             .
Karen Etheridge, ka...@etheridge.ca       GCS C+++$ USL+++$ P+++$ w--- M++

Reply via email to