- When `as_json` returns `Infinity` or `NaN` as the value of any of the key,
we don't used to call `as_json` on it as it was treated as primitive.
- This used to pass `Infinity` or `NaN` to `JSON.generate` and Ruby used
to throw an error for `Infinity/NaN not allowed in JSON.`
- This patch changes the code to call `as_json` on these primitives so
that they are converted to proper values before being passed to
prathamesh-sonpatki edited Nov 13, 2016 (most recent)
@pixeltrix I had a discussion about this issue with @matthewd at Rubyconf and he suggested that we merge and backport this change and after that deprecate the behvior from #2532 and #6096 on master, and eventually remove it in next to next release. I will open deprecation PR once this gets merged.