From: Eric Mahurin Date: 2005-10-27T00:25:29+09:00 Subject: Re: A comparison by example of keyword argument styles --- Trans wrote: > > define_method(:foo,obj.method(:bar)) > > You'd be calling the method right then and there. > > obj = "a" > def obj.method(k) ; "#{k} hey!" ; end > > define_method(:foo,obj.method(:bar)) > > same as > > define_method(:foo,"bar hey!") The "method" above is not meant to mean whatever method you feel like. I'm talking about Object#method that returns a Method object for the method name/symbol given as an argument. I'm talking about being able to do something like this: class C obj = "hello world!" define_method(:foo,obj.method(:[])) end C.new.foo(0,5) # => "hello" Instead you get an error like this because define_method tries to redefine self for obj.method(:[]). TypeError: bind argument must be a subclass of String from (irb):3:in `define_method' from (irb):3 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com