Coming from a Java background, I am a little perturbed by Ruby's completely blasé attitude toward its method parameters. Whereas in Java I could guarantee that parameter x was the type necessary for the method to work properly, in Ruby I have no way of guaranteeing that x is an integer, a string, or anything else for that matter.
Example: if I wanted to write an absolute_value method in Java, the header would be something like
public static int absoluteValue(int x)
In Ruby it would be something like
def self.absolute_value(x)
In this example, in the Java code I can be totally sure that the parameter being passed in isn't "Happy Birthday!" but in the Ruby code I don't know that. How do I prevent this situation in Ruby so the code doesn't crash at Runtime?