[macruby-changes] [3916] MacRuby/trunk/NSString.m
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 7 14:19:33 PDT 2010
Revision: 3916
http://trac.macosforge.org/projects/ruby/changeset/3916
Author: lsansonetti at apple.com
Date: 2010-04-07 14:19:32 -0700 (Wed, 07 Apr 2010)
Log Message:
-----------
better to_str()
Modified Paths:
--------------
MacRuby/trunk/NSString.m
Modified: MacRuby/trunk/NSString.m
===================================================================
--- MacRuby/trunk/NSString.m 2010-04-07 19:45:53 UTC (rev 3915)
+++ MacRuby/trunk/NSString.m 2010-04-07 21:19:32 UTC (rev 3916)
@@ -19,9 +19,15 @@
VALUE rb_cNSMutableString;
static inline VALUE
-to_str(VALUE ary)
+to_str(VALUE str)
{
- return rb_convert_type(ary, T_STRING, "String", "to_str");
+ switch (TYPE(str)) {
+ case T_STRING:
+ return str;
+ case T_SYMBOL:
+ return rb_sym_to_s(str);
+ }
+ return rb_convert_type(str, T_STRING, "String", "to_str");
}
static id
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100407/02307a3d/attachment-0001.html>
More information about the macruby-changes
mailing list