From: Dave Thomas Date: 2002-01-28T07:58:36+09:00 Subject: Re: how to find out which args a method can take Tobias Reif writes: > I know that I can pass wide varieties to some methods. What I thought > was: perhaps there are any built-in documentation like info bits that > can help whan generating "tests" for built-in methiods. Something like > Array.works_with_args?('join') # -> [[String]] > String.works_with_args('sub') # -> [[Regex,String], [Regex, Block]] > String.works_with_args('reverse') # -> [] But... Ruby classes are not types in this sense (although admittedly it works 99% of the time). For example, irbsh(main):001:0> e = Exception.new("hello") # irbsh(main):002:0> "123".sub(/./, e) "hello23" You _could_ find out some of the information you need by trying things and catching the TypeError exception, but that seems like a lot of work :) Dave