ruby-changes:13245
From: nobu <ko1@a...>
Date: Sat, 19 Sep 2009 00:44:39 +0900 (JST)
Subject: [ruby-changes:13245] Ruby:r25006 (trunk): * string.c: added rdocs for symbol.
nobu 2009-09-19 00:42:59 +0900 (Sat, 19 Sep 2009) New Revision: 25006 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25006 Log: * string.c: added rdocs for symbol. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 25005) +++ string.c (revision 25006) @@ -7334,12 +7334,28 @@ } } +/* + * call-seq: + * + * sym.succ + * + * Same as <code>sym.to_s.succ.intern</code>. + */ + static VALUE sym_succ(VALUE sym) { return rb_str_intern(rb_str_succ(rb_sym_to_s(sym))); } +/* + * call-seq: + * + * str <=> other => -1, 0, +1 + * + * Compares _sym_ with _other_ in string form. + */ + static VALUE sym_cmp(VALUE sym, VALUE other) { @@ -7349,6 +7365,14 @@ return rb_str_cmp_m(rb_sym_to_s(sym), rb_sym_to_s(other)); } +/* + * call-seq: + * + * sym.casecmp(other) => -1, 0, +1 + * + * Case-insensitive version of <code>Symbol#<=></code>. + */ + static VALUE sym_casecmp(VALUE sym, VALUE other) { @@ -7358,54 +7382,118 @@ return rb_str_casecmp(rb_sym_to_s(sym), rb_sym_to_s(other)); } +/* + * call-seq: + * sym =~ obj => fixnum or nil + * + * Returns <code>sym.to_s =~ obj</code>. + */ + static VALUE sym_match(VALUE sym, VALUE other) { return rb_str_match(rb_sym_to_s(sym), other); } +/* + * call-seq: + * sym[idx] => char + * sym[b, n] => char + * + * Returns <code>sym.to_s[]</code>. + */ + static VALUE sym_aref(int argc, VALUE *argv, VALUE sym) { return rb_str_aref_m(argc, argv, rb_sym_to_s(sym)); } +/* + * call-seq: + * sym.length => integer + * + * Same as <code>sym.to_s.length</code>. + */ + static VALUE sym_length(VALUE sym) { return rb_str_length(rb_id2str(SYM2ID(sym))); } +/* + * call-seq: + * sym.empty? => true or false + * + * Returns that _sym_ is :"" or not. + */ + static VALUE sym_empty(VALUE sym) { return rb_str_empty(rb_id2str(SYM2ID(sym))); } +/* + * call-seq: + * sym.upcase => symbol + * + * Same as <code>sym.to_s.upcase.intern</code>. + */ + static VALUE sym_upcase(VALUE sym) { return rb_str_intern(rb_str_upcase(rb_id2str(SYM2ID(sym)))); } +/* + * call-seq: + * sym.downcase => symbol + * + * Same as <code>sym.to_s.downcase.intern</code>. + */ + static VALUE sym_downcase(VALUE sym) { return rb_str_intern(rb_str_downcase(rb_id2str(SYM2ID(sym)))); } +/* + * call-seq: + * sym.capitalize => symbol + * + * Same as <code>sym.to_s.capitalize.intern</code>. + */ + static VALUE sym_capitalize(VALUE sym) { return rb_str_intern(rb_str_capitalize(rb_id2str(SYM2ID(sym)))); } +/* + * call-seq: + * sym.swapcase => symbol + * + * Same as <code>sym.to_s.swapcase.intern</code>. + */ + static VALUE sym_swapcase(VALUE sym) { return rb_str_intern(rb_str_swapcase(rb_id2str(SYM2ID(sym)))); } +/* + * call-seq: + * sym.encoding => encoding + * + * Returns the Encoding object that represents the encoding of _sym_. + */ + static VALUE sym_encoding(VALUE sym) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/