From: "nobu (Nobuyoshi Nakada)" Date: 2013-12-14T07:50:17+09:00 Subject: [ruby-core:59096] [ruby-trunk - Bug #9005][Assigned] object.send(:define_method, ...){...} creates private method Issue #9005 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Assigned Assignee set to nobu (Nobuyoshi Nakada) ---------------------------------------- Bug #9005: object.send(:define_method, ...){...} creates private method https://bugs.ruby-lang.org/issues/9005#change-43653 Author: jeremyevans0 (Jeremy Evans) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-09-22 trunk 43011) [i386-openbsd] Backport: I assume this is caused by r40022, which made define_method consider visibility. However, visibility should only be considered if define_method is called normally, not via send. When called via send, it should define a public method. Here's example code showing the error: $ ruby21 -ve "Object.send(:define_method, :foo){|*a| 1}.foo" -e:1:in `
': private method `foo' called for :foo:Symbol (NoMethodError) I apologize in advance if this has already been fixed (I tested 2.1.0-preview1, not trunk), but from the commit logs it doesn't appear to have been. -- http://bugs.ruby-lang.org/