зеркало из https://github.com/github/ruby.git
Make the metaclass of Refinement explicitly
Otherwise, singleton methods of Module are not inherited unless Refinement.singleton_class is called.
This commit is contained in:
Родитель
8a49c7e481
Коммит
37395ffa05
2
class.c
2
class.c
|
@ -689,6 +689,8 @@ Init_class_hierarchy(void)
|
||||||
RBASIC_SET_CLASS(rb_cObject, rb_cClass);
|
RBASIC_SET_CLASS(rb_cObject, rb_cClass);
|
||||||
RBASIC_SET_CLASS(rb_cRefinement, rb_cClass);
|
RBASIC_SET_CLASS(rb_cRefinement, rb_cClass);
|
||||||
RBASIC_SET_CLASS(rb_cBasicObject, rb_cClass);
|
RBASIC_SET_CLASS(rb_cBasicObject, rb_cClass);
|
||||||
|
|
||||||
|
ENSURE_EIGENCLASS(rb_cRefinement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2668,6 +2668,10 @@ class TestRefinement < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_inherit_singleton_methods_of_module
|
||||||
|
assert_equal([], Refinement.used_modules)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def eval_using(mod, s)
|
def eval_using(mod, s)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче