Be cautious with Ruby coercion methods
30-Jul-2020 1734
Coercion is a tricky problem to solve and it’s something we need pretty much everywhere. Whether you’re building a web application or a CLI tool, you will have to coerce values in some way. I say it’s a tricky problem because Ruby comes with many builtin coercion methods but it’s not enough. Furthermore, the builtin methods may actually lead to bugs or surprising behaviors.In this article we’ll take a look at the builtin coercion methods, various caveats that come with their usage and ways how you can handle coercion in a more predictable and strict way.
Be cautious with Ruby coercion methods #ruby #rubydeveloper #rubyonrails #cautious #coercion #methods https://rubyonrails.ba/link/be-cautious-with-ruby-coercion-methods