From: Jan Svitok Date: 2006-08-24T01:44:06+09:00 Subject: Re: Can methods be part of a array On 8/23/06, Dikshit Saumya-G19445 wrote: > Hi > I am a newbie to this mailing list. > > I have a couple of queries: > > 1. Can methods be part of an array definition, which can bear similarity > to 'C' definitions > of "array of function pointers", as part of a state machine > implementation. Look up Object#method and Method in the docs: you can do ['aaa'.method(:size), 10.method("+")] UnboundMethod could be useful as well. Other than that, its possible to call methods by name. I you just need to call methods on one object, it is enough to store just their names (preferably as symbols): methods = [:size, :length, :whatever] then you would for example do: methods.each {|m| 'aaaa'.send(m) }