Quoting vshepelev / imho.com.ua, on Fri, May 26, 2006 at 03:16:20PM +0900:
> From: Sam Roberts [mailto:sroberts / uniserve.com]
> Sent: Friday, May 26, 2006 9:11 AM
> > Quoting vshepelev / imho.com.ua, on Fri, May 26, 2006 at 02:50:27PM +0900:
> > > So, other question: is there way for uniform compare objects by some
> > > operator? (where operator is either == or != or <, or even include?)
> > 
> > Perhaps <=>
> 
> No-no.
> 
> The point was to do things like this:
> 
> def filter(object, op, criteria)
>   object.send op, criteria
> end
> 
> filter 'a', :==, 'b'
> filter 'Ruby', :include?, 'Ru'
> filter 110, :<, 15
> 
> #filter 'a', :!=, 'b' <== doesn't work! :(

Ok, I see.

Probably, its because you are showing us a small piece of a larger puzzle, but
why not have filter take a block:

  def filter(object, op, criteria)
     yield object, criteria
  end
  filter('a', 'b') { |o,c| o != c }

or even a proc:

  def filter(object, op, criteria)
     op.call(object, criteria)
  end
  filter('a', Proc.new{ |o,c| o != c }, 'b')

Cheers,
Sam