I used to go home during lunch every day to let my dog out. Many days, I was so busy that it seemed like a super chore that would really put me behind. But, it's insane how many insights I had and problems I solved when…
Using #respond_to? is normally a code smell. The point of duck typing is exactly that it allows you to avoid checking the type of a class. As long as the object responds to the correct messages, the type does not matter.
I don't think this is OK with any language.
I used to go home during lunch every day to let my dog out. Many days, I was so busy that it seemed like a super chore that would really put me behind. But, it's insane how many insights I had and problems I solved when…
Using #respond_to? is normally a code smell. The point of duck typing is exactly that it allows you to avoid checking the type of a class. As long as the object responds to the correct messages, the type does not matter.
I don't think this is OK with any language.