GGarramuno wrote:

>Is there a way to turn a method into a proc stored in a variable?
>Something similar to Perl's \& notation.
>
>Say I have a method written and I want to call it indirectly, thru a
>proc object.  I basically want to get the "address" of the method (or
>have a proc object referring to it)
>
>   def myfunc(t) 
>        puts t
>   end
>
>   t = \&myfunc      #this line is perl's way of doing it
>   t.call("hello")
>
>The idea behind calling functions like these indirectly is so as to
>have the ability of the proc object to refer to built methods and/or
>on the fly written procs.
>Ruby seems to have this functionality, but I cannot find the proper
>syntax.
>
>  
>

Use the "method" method:

  t = method( :myfunc )
  t.call( "hello" )

-- 
Jamis Buck
jgb3 / email.byu.edu

ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'