summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-02 08:53:06 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-02 08:53:06 +0000
commitb14e2b4401db4746cc45ae9e4ce6350f7594f84f (patch)
tree3726d4898740647bb09ada304ce5f5693664b7cb /eval.c
parenta8b3d67e7c78d6be55e030159db5d611d8b5a247 (diff)
* object.c (rb_mod_to_s): Module#{to_s,inspect}, when invoked on
a refinement, returns a string in the format #<refinement:C@M>, where C is a refined class and M is a module at which the refinemet is defined. * eval.c (rb_mod_refine): store information on a refinement for the above change. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 08d20d2204..21c33137f0 100644
--- a/eval.c
+++ b/eval.c
@@ -1218,7 +1218,7 @@ rb_mod_refine(VALUE module, VALUE klass)
{
NODE *cref = rb_vm_cref();
VALUE mod;
- ID id_refinements, id_refined_class;
+ ID id_refinements, id_refined_class, id_defined_at;
VALUE refinements;
if (!rb_block_given_p()) {
@@ -1236,6 +1236,8 @@ rb_mod_refine(VALUE module, VALUE klass)
mod = rb_module_new();
CONST_ID(id_refined_class, "__refined_class__");
rb_ivar_set(mod, id_refined_class, klass);
+ CONST_ID(id_defined_at, "__defined_at__");
+ rb_ivar_set(mod, id_defined_at, module);
rb_define_singleton_method(mod, "method_added",
refinement_module_method_added, 1);
rb_define_singleton_method(mod, "include",