mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* eval.c (rb_mod_freeze): prepare string representation before
freezing. [ruby-talk:103646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1135c41a5b
commit
9d1f9bd56b
5 changed files with 27 additions and 11 deletions
16
object.c
16
object.c
|
@ -1213,6 +1213,21 @@ rb_mod_to_s(klass)
|
|||
return rb_str_dup(rb_class_name(klass));
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* mod.freeze
|
||||
*
|
||||
* Prevents further modifications to <i>mod</i>.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rb_mod_freeze(mod)
|
||||
VALUE mod;
|
||||
{
|
||||
rb_mod_to_s(mod);
|
||||
return rb_obj_freeze(mod);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* mod === obj => true or false
|
||||
|
@ -2597,6 +2612,7 @@ Init_Object()
|
|||
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
|
||||
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
|
||||
|
||||
rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0);
|
||||
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
|
||||
rb_define_method(rb_cModule, "==", rb_obj_equal, 1);
|
||||
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue