Optimizing Ruby's JSON, Part 2 Posted by mscccc on Wednesday December 18, 2024 @11:18AM from the byroot.github.io dept. https://byroot.github.io/ruby/json/2024/12/18/optimizing-ruby-json-part-2.html ( 1 comment | 2 points | on HN )
def dump(obj, anIO = (no_args_set = true; nil), limit = nil, kwargs = nil)
I love that trick because it exploits the fact that, like pretty much everything in Ruby, arguments’ default values are expressions. This trick is most commonly used when you need to know if an argument was passed as nil or just not passed
Pretty cool way to do nil checking