Weird Ruby: Nil Conversions | Meta Redux
01-Mar-2024 599
With those methods you can literally create something (e.g. an empty hash) out of nothing! Whether you should actually be doing this is a totally different matter, though. According to the class docs:The converter methods are carrying the concept of nullity to other classes.I’m not sure how this “concept of nullity” is defined, but I’ve always found it weird that you can equate the absence of value with some anchor value (e.g. an empty collection or 0). I know there are contexts in which this may be useful, but I’m fairly certain you’d be able to get similar results without resorting to such conversions.Keep in mind that you can do similar conversions in a different way:.
Weird Ruby: Nil Conversions | Meta Redux #ruby #rubydeveloper #rubyonrails #Weird #Ruby: #Conversions #Redux https://rubyonrails.ba/link/weird-ruby-nil-conversions-meta-redux