summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-18 15:42:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-18 15:42:59 +0000
commitbdde51172cbf2754f6bbaa9e1678fbcc3d689dba (patch)
treee16846a85cda9277f5f8451635c0166f548e267d
parentffcd041c7ae83d7844c0f485c49e1183903ecf29 (diff)
* string.c: added rdocs for symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--string.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/string.c b/string.c
index dbf14f8ac38..1d15f9a6e85 100644
--- a/string.c
+++ b/string.c
@@ -7334,12 +7334,28 @@ sym_to_proc(VALUE sym)
}
}
+/*
+ * 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 @@ sym_cmp(VALUE sym, VALUE other)
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 @@ sym_casecmp(VALUE sym, VALUE other)
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)
{