From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_PASS,T_DKIM_INVALID, T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 6EF0220C32 for ; Fri, 8 Dec 2017 11:20:08 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A4D6C120914; Fri, 8 Dec 2017 20:20:04 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2F52F120907 for ; Fri, 8 Dec 2017 20:20:01 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=bF0ruUJrzl0ah0rpBkuAs0m3Hdw=; b=u1bUk82F9T11eegSBi KeIoIiCvGpgkWO8Rt2St/SCmKsgNRfGTAna1DlhmJ/SzPNlUTvPBvDjTkVcRHqcL A9HAH5b6MLMAjuTlI6G6yzYNXyYcOMHpt9HixJo2C05NngGtz+38p21vRnCP+I+n F1/AKUga9RJYDASFR1phXdAd0= Received: by filter0001p3las1.sendgrid.net with SMTP id filter0001p3las1-16826-5A2A755B-4B 2017-12-08 11:19:56.112356007 +0000 UTC Received: from herokuapp.com (ec2-54-162-239-32.compute-1.amazonaws.com [54.162.239.32]) by ismtpd0023p1iad2.sendgrid.net (SG) with ESMTP id zJKdO-N2R96fD9sJoBmetg for ; Fri, 08 Dec 2017 11:19:55.876 +0000 (UTC) Date: Fri, 08 Dec 2017 11:19:56 +0000 (UTC) From: shevegen@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 59273 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14160 X-Redmine-Issue-Author: StefanPochmann X-Redmine-Sender: shevegen X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4r5f4zrcBPt79GLRFteF1jJAEmqE3j2dHpPJ CG9VCntO8QJRuCKk09FNYcV5FaTaf+Ffjy4K34CcgN5+HjkbtVzgQECHU2GoMePqYga0PdtOrcPhD7 j5OnvT0oSNZOqOGXWFQKWV6meVdTtqkE37sxE39nIoMrTx3/l9El8HvXpw== X-ML-Name: ruby-core X-Mail-Count: 84129 Subject: [ruby-core:84129] [Ruby trunk Bug#14160] JSON#generate documentation wrong/misleading X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "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/