Duck Typing
- Ruby is a dynamically typed langage.
- Typing is defined at the runtime.
#
Duck Test:If it walks like a duck and it quacks like a duck, then it must be a duck.
- Here the a variable responds to map and returns the expected object.
- So it's valid to think that the variable is an Array.
#
Ruby will determine the type for us#
Check:- /typed
#
Resources:Good Article: https://medium.com/rubycademy/why-ruby-community-encourages-duck-typing-2e5fb529fca1