diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-16 14:21:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-16 14:21:34 +0000 |
commit | 36eb4607805367a999f0546d9bb2f2950e5bb860 (patch) | |
tree | 320fa0a5d0d2ff51cd4ef583ab2bbdeada98d96c /object.c | |
parent | f5b3969eda777ef41b8b0f5b397acee8e52d420c (diff) |
* eval.c (rb_mod_freeze): prepare string representation before
freezing. [ruby-talk:103646]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1241,6 +1241,21 @@ rb_mod_to_s(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 * * Case Equality---Returns <code>true</code> if <i>anObject</i> is an @@ -2570,6 +2585,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); |