I have just a general question, dont know if this place is the right spot to ask, but i give it a try:
coming from java, its hard not to define variables in methods. Sometimes it is a pro and makes stuff easier, but at the same time i feel like loosing control over potential errors. In java you can overload methods, but how do you do that in ruby? Do i have to check the variable type of the input (how can i do that?) inside the method if i want to execute different code depending on the type of the input. Pseudocode example:
def my_method(input) if input.type=string # do something with strings elsif input.type=integer # do something with integers elsif input.type=float # do something with floats end end
Looks kinda messy to me… Any suggestion or explenation is appreciated!