In article <3ab5810e$1_2 / news.pacifier.com>,
 "Doug Edmunds" <dae_alt3 / juno.com> wrote:

> #the array I am interested in
> p self.methods
> ...
> It's the difference between
> p self.singleton_methods
> and
> p "self.singleton_methods"

I _think_ what you are looking for in Object#send, it allows you to tell 
any object (including self) to run some method. Here is an example:

#!/usr/local/bin/ruby -w 
 
class Example 
  def meth_1 
    return "method 1 result" 
  end
  def meth_2 
    return "method 2 result" 
  end
  def meth_3 
    return "method 3 result" 
  end 
  def run 
    test_methods = self.methods.grep /meth_/ 
    p test_methods 
    test_methods.each { |m| 
      p self.send(m) 
    } 
  end 
end 
Example.new.run 

------

and the output:

[503] ./test.rb 
./test.rb:18: warning: ambiguous first argument; make sure 
["meth_3", "meth_2", "meth_1"] 
"method 3 result" 
"method 2 result" 
"method 1 result" 

-- 
http://www.zenspider.com/Languages/Ruby/