Weird Ruby: Nil Conversions | Meta Redux

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 https://rubyonrails.ba/single/weird-ruby-nil-conversions-meta-redux

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles