summaryrefslogtreecommitdiff
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
commitab24be4e98660f4fbef44a03262f25988a260b9f (patch)
treecb5aa15714754619f0848fb2dacff076246cb74d /string.c
parentb53549941d4d543191c91054e974598b0e29210b (diff)
* 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: svn+ssh://ci.ruby-lang.org/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 99813c9694..44f78a6b34 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;
}