summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-13 04:06:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-13 04:06:40 +0000
commit06675418948d45f5448c7b722f1e7c990f5c89bc (patch)
tree5f07d9ecba8ac6b5ad25ad43947288286a96ef82 /proc.c
parentcd9d004e7ff8ec567bc10f067260ee4da33d028d (diff)
method transplanting
* proc.c (umethod_bind): allow another form of method transplanting from a module via UnboundMethod. [ruby-core:34267][Feature #4254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index a112677e69..dc13c7e418 100644
--- a/proc.c
+++ b/proc.c
@@ -1620,7 +1620,8 @@ umethod_bind(VALUE method, VALUE recv)
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
- if (data->rclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, data->rclass)) {
+ if (!RB_TYPE_P(data->rclass, T_MODULE) &&
+ data->rclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, data->rclass)) {
if (FL_TEST(data->rclass, FL_SINGLETON)) {
rb_raise(rb_eTypeError,
"singleton method called for a different object");