Robert Klemme <bob.news / gmx.net> wrote:
 
> No, this seems overly complex to me and (more important) these tests have
> nothing to do with Sets per se.  You should then create a sub class of Set
> that contains all match methods.  But the other approach (individual
> classes per test) is more modular, flexible and easier to extend.  If you
> hava a single Set sub class that contains all tests you'd have to use
> something like this for all matches
> 
> def all_matches?
>  public_methods.grep( /^match/ ).each do |m|
>    return false unless self.send m
>  end
>  true
> end

This seems rather heavy and, well, Java-like (where you're forced to
create a class because you can't have unattached procs). A test is,
conceptually, an unbound function, and Ruby does indeed give us a
mechanism to create such. 

martin