From: hsbt@... Date: 2020-01-06T06:18:17+00:00 Subject: [ruby-core:96679] [Ruby master Bug#14160] JSON#generate documentation wrong/misleading Issue #14160 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Assigned to Closed Applied at https://github.com/ruby/ruby/commit/1658e6b5db0380c39d2423281e10acc5b6c6a8bd ---------------------------------------- Bug #14160: JSON#generate documentation wrong/misleading https://bugs.ruby-lang.org/issues/14160#change-83663 * Author: StefanPochmann (Stefan Pochmann) * Status: Closed * Priority: Normal * Assignee: hsbt (Hiroshi SHIBATA) * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- https://docs.ruby-lang.org/en/trunk/JSON.html#module-JSON-label-Generating+JSON That says `JSON.generate` only allows "objects or arrays", that `to_json` allows more, and uses `1.to_json` as an example for that. But I just tried `JSON.generate(1)` and it works as well. What's up with that? https://docs.ruby-lang.org/en/trunk/JSON.html#method-i-generate That talks about `state` a lot. I think it should say `opts`, as that is the argument name, no? Also, it says "state is * a JSON::State object". Note the "*". I think this should be a bullet point, i.e., "a JSON::State object" should be an item in the list following it. -- https://bugs.ruby-lang.org/ Unsubscribe: