summaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 10:56:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 10:56:14 +0000
commitf47627e8a345860942490ca60cfb18f6820fa0f9 (patch)
tree4fa1b092f971cf48a10af796fcb443a82c89ca77 /variable.c
parentb500f3c9a5880b4ca0da3d358673d02e4952ce52 (diff)
merges r24321 from trunk into ruby_1_9_1.
-- * insns.def (defineclass): preserve encoding of class/module names. [ruby-core:24600] * variable.c (rb_set_class_path_string): set class path with a string value. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@24450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index 5d4a4ad2c..03efd1de1 100644
--- a/variable.c
+++ b/variable.c
@@ -212,6 +212,23 @@ rb_class_path(VALUE klass)
}
void
+rb_set_class_path_string(VALUE klass, VALUE under, VALUE name)
+{
+ VALUE str;
+
+ if (under == rb_cObject) {
+ str = rb_str_new_frozen(name);
+ }
+ else {
+ str = rb_str_dup(rb_class_path(under));
+ rb_str_cat2(str, "::");
+ rb_str_append(str, name);
+ OBJ_FREEZE(str);
+ }
+ rb_ivar_set(klass, classpath, str);
+}
+
+void
rb_set_class_path(VALUE klass, VALUE under, const char *name)
{
VALUE str;