From: Paul Stickney Date: 2007-03-25T21:45:59+09:00 Subject: Re: pointer to function I have no idea what all that's supposed to do. In Ruby you have methods (and Procs), but focusing on the methods--they are invoked by a message. Normally this is done magically for you. my_obj.my_method sends "my_method" to "my_obj". Play with it in IRB: class Me def name "Paul" end end m = Me.new m.name # => "Paul" m.send :name # => "Paul" class LetSomeRun def initialize @runnable = %w/first second/ end def first; puts "running first" end def second; puts "running second" end def run (m) if @runnable.include? m send m else raise "Can't run that!" end end end r = LetSomeRun.new r.run "first" r.run "oops" # oops :( You could also take a slightly different approach using Proc objects; lambda works similar to how `sub {}` works in Perl. x = lambda {|name| puts "hello #{name}!"} x.call "fred" So... class Runnable2 def initialize @runnable = { "first" => lambda {|this, *args| this.run "second", "hello!"}, "second" => lambda {|this, *args| puts args.first} } end def run (m, *args) @runnable.include? m and @runnable[m].call self, *args end end Runnable2.new.run "first" I'm not exactly sure if this answers your question but, enjoy. Paul