Actions
Bug #9141
closeddefine_singleton_method creates private method
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-09-22 trunk 43011) [x86_64-darwin12.5.0]
Description
Hello,
I stumbled upon the following problem:
irb(main):001:0> guy = "Bob"
=> "Bob"
irb(main):002:0> guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
=> :hello
irb(main):003:0> guy.hello
NoMethodError: private method `hello' called for "Bob":String
from (irb):3
Updated by jeremyevans0 (Jeremy Evans) about 11 years ago
This is probably related to #9005.
Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
- Status changed from Open to Closed
This issue was solved with changeset r44380.
Jeremy, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
proc.c: make method by define_method public
- proc.c (rb_mod_define_method): consider visibility only if self
in the caller is same as the receiver, otherwise make public as
well as old behavior. [ruby-core:57747] [Bug #9005]
[ruby-core:58497] [Bug #9141] - vm.c (rb_vm_cref_in_context): return ruby level cref if self is
same.
Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1.0: REQUIRED
Actions
Like0
Like0Like0Like0