From: Tamara Temple Date: 2013-06-06T21:15:13+09:00 Subject: Playing with method_missing -- argument list In https://gist.github.com/tamouse/5719507 , I've been playing around with using Struct, Enumerable, Comparable and lastly method_missing, and here's where I got stuck. At lines 67-69 ("This is going to be fun"), I collect the instance methods defined in each of Array, Hash, and String, to be able to pass them along to each of the components of MyClass. The problem now comes, how many arguments do I pass along as well? My test example, #keys from Hash, shows my problem. #keys takes no arguments, but even if the argument list is empty, it's an empty Array, which of course is something. In some contexts this might be fine, but in others, not so much. So, is there a way to detect the number of arguments a method takes? Or, would it be better to detect the size of args at that point and send zero, one or many to the attribute's method? Thinking something like: def check_size(args) case args.size when 0 ; nil when 1 ; args.first else args end (only maybe not so weak a method name) AND, is this already a standard function/idiom?