On Wed, Dec 5, 2012 at 12:17 PM, Martin Hansen <lists / ruby-forum.com> wrote:
> I need some hints to organize my code, so I avoid name space collision
> of the method patmatch() - which happens when I run the unit test suite.
>
> The layout of my code is here:
>
> http://pastie.org/5483165

It depends on the lifetime of the association between a Seq instance
and a particular #patmatch algorithm.  Basically these are the options

1. all instances of Seq have the same algo (what you currently have,
implemented via include)
2. an instance of Seq has an algo for its entire lifetime (can be
decided any time, implemented via extend)
3. an instance of Seq can change the algorithm at will (typical case
for delegation aka strategy pattern).

Your tests apparently require at least 2, maybe 3 but your
implementation only delivers 1.  That looks like a design issue.

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/