ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: kachick1@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:70678] [Ruby trunk - Bug #11512] [Open] DelegateClass.#public_{instance_}methods are returning difference values.
Date: Mon, 07 Sep 2015 17:00:35 +0000	[thread overview]
Message-ID: <redmine.issue-11512.20150907170033.4c29535f539e2c34@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11512.20150907170033@ruby-lang.org

Issue #11512 has been reported by Kenichi Kamiya.

----------------------------------------
Bug #11512: DelegateClass.#public_{instance_}methods are returning difference values.
https://bugs.ruby-lang.org/issues/11512

* Author: Kenichi Kamiya
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Is this intended behavior?

A patch is PR#926(https://github.com/ruby/ruby/pull/926)

~~~
require 'delegate'

class Parent
  def parent_public; end

  protected

  def parent_protected; end
end

class Child < Parent
end

class DelegatorChild < DelegateClass(Parent)
end

class Parent
  def parent_public_added; end

  protected

  def parent_protected_added; end
end

ignores = Object.public_instance_methods | Delegator.public_instance_methods

p(Child.public_instance_methods - ignores)                 #=> [:parent_public, :parent_public_added]
p(Child.new.public_methods - ignores)                      #=> [:parent_public, :parent_public_added]

p(DelegatorChild.public_instance_methods - ignores)        #=> got: [:parent_public], expected: [:parent_public, :parent_public_added]
p(DelegatorChild.new(Parent.new).public_methods - ignores) #=> got: [:parent_public, :parent_public_added, :parent_protected]], expected: [:parent_public, :parent_public_added]
~~~



-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2015-09-07 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11512.20150907170033@ruby-lang.org>
2015-09-07 17:00 ` kachick1 [this message]
2019-05-24  5:02 ` [ruby-core:92812] [Ruby trunk Bug#11512] DelegateClass.#public_{instance_}methods are returning difference values merch-redmine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-11512.20150907170033.4c29535f539e2c34@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).