Ruby refinements and the sorbet type checker
28-Nov-2019 2102
But now we sacrifice readability by defining what we will do with the result before we tell the user what we are doing in the first place. To me, calling the rmeove_nil_keys method overshadows the actual function we are performing. The method also now doesn’t depend on the instance state so we end up moving it to a class method, in short, we now have a MyClass.remove_nil_keys which makes no sense and you just know that from SomeUnrelatedClass someone will call MyClass.remove_nil_keys or copy and paste it to where it’s additionally needed.
Ruby refinements and the sorbet type checker #ruby #rubydeveloper #rubyonrails #refinements #sorbet #checker #type https://rubyonrails.ba/link/ruby-refinements-and-the-sorbet-type-checker