Meet Duck Typer: your new duck typing friend
27-Mar-2026 277
The Ruby language leans on duck typing rather than formal interfaces. “If it walks like a duck and quacks like a duck, it’s a duck.”
bodies = [poem, essay, case_study, user_manual].map(&:body)
These objects come from different classes but all respond to body, so you can treat them uniformly. That’s informal polymorphism: no type annotations, no ceremony.
Duck typing is great, but what I miss is enforcement. If one class implements a method and another forgets to, I want something to complain.
Meet Duck Typer: your new duck typing friend #ruby #rubydeveloper #rubyonrails #Typer: #typing #friend #typer: https://www.rubyonrails.ba/link/meet-duck-typer-your-new-duck-typing-friend