Project

General

Profile

Actions

Bug #9141

closed

define_singleton_method creates private method

Added by Soilent (Konstantin x) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-09-22 trunk 43011) [x86_64-darwin12.5.0]
[ruby-core:58497]

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


Related issues 2 (0 open2 closed)

Related to Backport21 - Backport #9296: please backport r44380 (visibility of methods defined by define_method)Closednaruse (Yui NARUSE)12/25/2013Actions
Is duplicate of Ruby master - Bug #9005: object.send(:define_method, ...){...} creates private methodClosednobu (Nobuyoshi Nakada)10/09/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0