From: wegzumir Date: 2006-01-27T13:28:00+09:00 Subject: Re: Pass References To Methods As Arguments? On 1/26/06, Joel VanderWerf wrote: > > # first, using a proc > print_unix_line = lambda { |arg| > print arg, "\n" > } > > # second, using a method > def print_windows_line_method arg > print arg, "\015\012" > end > > print_windows_line = method :print_windows_line_method > > def call_a_routine routine, arg > routine.call(arg) # or routine[arg] > end > > call_a_routine print_unix_line, 'Hello, unix World!' > call_a_routine print_windows_line, 'Hello, Windows World!' > > > > > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > Thanks for the reply! One of the things I had tried was using the colon character like that, but I didn't know about also passing the resulting symbol to "method" as an argument like that. And of course I also wasn't going down the lamdba path which I'll have to do more experimenting with. Much appreciated.