ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:84128] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading
       [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
@ 2017-12-08 10:12 ` stefan.pochmann
  2017-12-08 11:19 ` [ruby-core:84129] " shevegen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: stefan.pochmann @ 2017-12-08 10:12 UTC (permalink / raw)
  To: ruby-core

Issue #14160 has been reported by StefanPochmann (Stefan Pochmann).

----------------------------------------
Bug #14160: JSON#generate documentation wrong/misleading
https://bugs.ruby-lang.org/issues/14160

* Author: StefanPochmann (Stefan Pochmann)
* Status: Open
* Priority: Normal
* Assignee: 
* 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:84129] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading
       [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
  2017-12-08 10:12 ` [ruby-core:84128] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading stefan.pochmann
@ 2017-12-08 11:19 ` shevegen
  2019-08-26  0:25 ` [ruby-core:94552] [Ruby master " merch-redmine
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: shevegen @ 2017-12-08 11:19 UTC (permalink / raw)
  To: ruby-core

Issue #14160 has been updated by shevegen (Robert A. Heiler).


You are right, the statement in the documentation that .generate() only allows "objects
or arrays" is technically not logical. Firstly, in ruby everything is an object, or
at the least, when we include Integers and Symbols, object-like in their behaviour (they
have the same object_id all the time of course, unlike e. g. String objects).

I would suggest to change the wording, to also expand it with more examples, not just
via "1" alone, and to clear up the comment about JSON.generate(). 

----------------------------------------
Bug #14160: JSON#generate documentation wrong/misleading
https://bugs.ruby-lang.org/issues/14160#change-68230

* Author: StefanPochmann (Stefan Pochmann)
* Status: Open
* Priority: Normal
* Assignee: 
* 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:94552] [Ruby master Bug#14160] JSON#generate documentation wrong/misleading
       [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
  2017-12-08 10:12 ` [ruby-core:84128] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading stefan.pochmann
  2017-12-08 11:19 ` [ruby-core:84129] " shevegen
@ 2019-08-26  0:25 ` merch-redmine
  2019-12-29 12:53 ` [ruby-core:96571] " hsbt
  2020-01-06  6:18 ` [ruby-core:96679] " hsbt
  4 siblings, 0 replies; 5+ messages in thread
From: merch-redmine @ 2019-08-26  0:25 UTC (permalink / raw)
  To: ruby-core

Issue #14160 has been updated by jeremyevans0 (Jeremy Evans).


I added a pull request to fix the first issue: https://github.com/flori/json/pull/384

There is an existing pull request to fix the second issue: https://github.com/flori/json/pull/347

----------------------------------------
Bug #14160: JSON#generate documentation wrong/misleading
https://bugs.ruby-lang.org/issues/14160#change-81003

* Author: StefanPochmann (Stefan Pochmann)
* Status: Open
* Priority: Normal
* Assignee: 
* 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96571] [Ruby master Bug#14160] JSON#generate documentation wrong/misleading
       [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-08-26  0:25 ` [ruby-core:94552] [Ruby master " merch-redmine
@ 2019-12-29 12:53 ` hsbt
  2020-01-06  6:18 ` [ruby-core:96679] " hsbt
  4 siblings, 0 replies; 5+ messages in thread
From: hsbt @ 2019-12-29 12:53 UTC (permalink / raw)
  To: ruby-core

Issue #14160 has been updated by hsbt (Hiroshi SHIBATA).

Assignee set to hsbt (Hiroshi SHIBATA)
Status changed from Open to Assigned
Tags set to doc

----------------------------------------
Bug #14160: JSON#generate documentation wrong/misleading
https://bugs.ruby-lang.org/issues/14160#change-83529

* Author: StefanPochmann (Stefan Pochmann)
* Status: Assigned
* 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96679] [Ruby master Bug#14160] JSON#generate documentation wrong/misleading
       [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2019-12-29 12:53 ` [ruby-core:96571] " hsbt
@ 2020-01-06  6:18 ` hsbt
  4 siblings, 0 replies; 5+ messages in thread
From: hsbt @ 2020-01-06  6:18 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-06  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-14160.20171208101238@ruby-lang.org>
2017-12-08 10:12 ` [ruby-core:84128] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading stefan.pochmann
2017-12-08 11:19 ` [ruby-core:84129] " shevegen
2019-08-26  0:25 ` [ruby-core:94552] [Ruby master " merch-redmine
2019-12-29 12:53 ` [ruby-core:96571] " hsbt
2020-01-06  6:18 ` [ruby-core:96679] " hsbt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).