From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id D9B8D1F97E for ; Sat, 24 Nov 2018 06:44:01 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F2196121511; Sat, 24 Nov 2018 15:43:58 +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 B4D7212150D for ; Sat, 24 Nov 2018 15:43:55 +0900 (JST) Received: by filter0062p3las1.sendgrid.net with SMTP id filter0062p3las1-4492-5BF8F327-3 2018-11-24 06:43:51.157869002 +0000 UTC m=+728441.543537722 Received: from herokuapp.com (ec2-54-163-93-180.compute-1.amazonaws.com [54.163.93.180]) by ismtpd0038p1iad2.sendgrid.net (SG) with ESMTP id 1dGoJoHaSS-UJ59g2V31ag Sat, 24 Nov 2018 06:43:50.944 +0000 (UTC) Date: Sat, 24 Nov 2018 06:43:52 +0000 (UTC) From: mame@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65420 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11689 X-Redmine-Issue-Author: yui-knk X-Redmine-Sender: mame 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7Ke/ugq7nSnsMKsze7+C6xJAt9UBfqPfZUSD E3sLt7fYCpbDdzpwB3NxUwX3JxbgDN48/W4dwXy9xd05Ohpf53kFg5b5rfCqfdjXuvgFu+5hd4Oqpb Km9FfSxIHklUBc9y/2JHalo0ElPcSKRONghYQZkEBQq2CzxN11P0sre0QQ== X-ML-Name: ruby-core X-Mail-Count: 90024 Subject: [ruby-core:90024] [Ruby trunk Feature#11689] Add methods allow us to get visibility from Method and UnboundMethod object. 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 #11689 has been updated by mame (Yusuke Endoh). I don't think that `send("#{method.visibility}_instance_methods")` would be a frequent, strongly-recommended idiom. You can do it more explicitly as follows. ``` def visibility(method) case when method.public? then "public_instance_methods" when method.protected? then "protected_instance_methods" when method.private? then "private_instance_methods" else raise "unknown method type" end end ``` This code would require work if a new visibility is introduced. But, there is no plan to add a new visibility in foreseeable future. Also, if something is actually introduced, there is no guarantee that the idiom would work as is. ---------------------------------------- Feature #11689: Add methods allow us to get visibility from Method and UnboundMethod object. https://bugs.ruby-lang.org/issues/11689#change-75129 * Author: yui-knk (Kaneko Yuichiro) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Add `Method#visibility` and `UnboundMethod#visibility` for getting visibility from Method and UnboundMethod object. In GitHub https://github.com/ruby/ruby/pull/1098. ---Files-------------------------------- 0001-Add-Method-visibility-and-UnboundMethod-visibility.patch (3.11 KB) -- https://bugs.ruby-lang.org/