summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-10 09:40:13 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-10 09:40:13 +0000
commit89800697e5d28d123be00de047c85b4c44ce4c61 (patch)
treecb5aa15714754619f0848fb2dacff076246cb74d /string.c
parent1b4a61b687fad86598831bd565800abf2f60f4c8 (diff)
downloadruby-89800697e5d28d123be00de047c85b4c44ce4c61.tar.gz
ruby-89800697e5d28d123be00de047c85b4c44ce4c61.tar.xz
ruby-89800697e5d28d123be00de047c85b4c44ce4c61.zip
* array.c (rb_ary_to_a): return value should be an Array if the
receiver is an instance of subclass of Array. * string.c (rb_str_to_s): return value should be a String if the receiver is an instance of subclass of String. * eval.c (rb_call): calls method_missing when superclass method does not exist. * eval.c (rb_f_missing): now handles "no super" case. * object.c (rb_obj_ivar_get): Object#instance_variable_get: new method to get instance variable value without eval(). [new] * object.c (rb_obj_ivar_set): Object#instance_variable_set: new method to set instance variable value without eval(). [new] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/string.c b/string.c
index 99813c969..44f78a6b3 100644
--- a/string.c
+++ b/string.c
@@ -1849,6 +1849,11 @@ static VALUE
rb_str_to_s(str)
VALUE str;
{
+ if (rb_obj_class(str) != rb_cString) {
+ VALUE dup = str_alloc(rb_cString);
+ rb_str_replace(dup, str);
+ return dup;
+ }
return str;
}