Hi--

Just FYI. I do not think this is what one calls a Functor exactly,
since the object is independent of the method ( please see
http://jakarta.apache.org/commons/sandbox/functor/ ).

What you have is sort of an OpenStruct for methods. While closely
related it's not exactly the same. I think the going name for what you
have defined is MethodProc ( see
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/114197  ).

Of course, by strict definition a Method _is_ a Functor. But that
doesn't get us very far ;-)  I take it a step further and consider a
Functor a "MetaMethod". Ruby Carats (yet to be released) includes just
such a Functor class. Here is the trival use case:

  require 'carat/functor'

  f = Functor.new { |op, x| x.send(op, x) }
  f + 1  #=> 2
  f + 2  #=> 4
  f + 3  #=> 6
  f * 1  #=> 1
  f * 2  #=> 2
  f * 3  #=> 9

Here's the definition:

class Functor
  def initialize(&func)
    @func = func
  end
  def method_missing(op, *args)
    @func.call(op, *args)
  end
end

Hope you find this of interest,
T