> Is there a way to do this in Ruby? I am aware of method(*args) and > case...when but I think Java's version is cleaner and more readable. I > also know that variables in Ruby are dynamically typed, the method that > is called should be based on the most recent type of the variable being > passed. What about this? class String def foo puts 'String' end end class Numeric def foo puts 'Numeric' end end x1 = 1 x2 = 'string' x1.foo x2.foo