[前][次][番号順一覧][スレッド一覧]

ruby-changes:70285

From: Burdette <ko1@a...>
Date: Sat, 18 Dec 2021 08:02:23 +0900 (JST)
Subject: [ruby-changes:70285] 5588aa79d4 (master): What's Here for Symbol (#5289)

https://git.ruby-lang.org/ruby.git/commit/?id=5588aa79d4

From 5588aa79d4587956ac1ae1734407f21717ad379a Mon Sep 17 00:00:00 2001
From: Burdette Lamar <BurdetteLamar@Y...>
Date: Fri, 17 Dec 2021 17:02:12 -0600
Subject: What's Here for Symbol (#5289)

* What's Here for Symbol
---
 string.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/string.c b/string.c
index eaf7f7f897f..678f63781a1 100644
--- a/string.c
+++ b/string.c
@@ -11273,6 +11273,65 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L11273
  * Symbol objects represent identifiers, while String objects
  * represent text or data.
  *
+ * == What's Here
+ *
+ * First, what's elsewhere. \Class \Symbol:
+ *
+ * - Inherits from {class Object}[Object.html#class-Object-label-What-27s+Here].
+ * - Includes {module Comparable}[Comparable.html#module-Comparable-label-What-27s+Here].
+ *
+ * Here, class \Symbol provides methods that are useful for:
+ *
+ * - {Querying}[#class-Symbol-label-Methods+for+Querying]
+ * - {Comparing}[#class-Symbol-label-Methods+for+Comparing]
+ * - {Converting}[#class-Symbol-label-Methods+for+Converting]
+ *
+ * === Methods for Querying
+ *
+ * - ::all_symbols:: Returns an array of the symbols currently in Ruby's symbol table.
+ * - {#=~}[#method-i-3D~]:: Returns the index of the first substring
+ *                          in symbol that matches a given Regexp
+ *                          or other object; returns +nil+ if no match is found.
+ * - #[], #slice :: Returns a substring of symbol
+ *                  determined by a given index, start/length, or range, or string.
+ * - #empty?:: Returns +true+ if +self.length+ is zero; +false+ otherwise.
+ * - #encoding:: Returns the Encoding object that represents the encoding
+ *               of symbol.
+ * - #end_with?:: Returns +true+ if symbol ends with
+ *                any of the given strings.
+ * - #match:: Returns a MatchData object if symbol
+ *            matches a given Regexp; +nil+ otherwise.
+ * - #match?:: Returns +true+ if symbol
+ *             matches a given Regexp; +false+ otherwise.
+ * - #length, #size:: Returns the number of characters in symbol.
+ * - #start_with?:: Returns +true+ if symbol starts with
+ *                  any of the given strings.
+ *
+ * === Methods for Comparing
+ *
+ * - {#<=>}[#method-i-3C-3D-3E]:: Returns -1, 0, or 1 as a given symbol is smaller than, equal to, or larger than symbol.
+ * - {#==, #===}[#method-i-3D-3D]:: Returns +true+ if a given symbol
+ *                                  has the same content and encoding.
+ * - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given
+ *              symbol is smaller than, equal to, or larger than symbol.
+ * - #casecmp?:: Returns +true+ if symbol is equal to a given symbol
+ *               after Unicode case folding; +false+ otherwise.
+ *
+ * === Methods for Converting
+ *
+ * - #capitalize:: Returns symbol with the first character upcased
+ *                 and all other characters downcased.
+ * - #downcase:: Returns symbol with all characters downcased.
+ * - #inspect:: Returns the string representation of +self+ as a symbol literal.
+ * - #name:: Returns the frozen string corresponding to symbol.
+ * - #succ, #next:: Returns the symbol that is the successor to symbol.
+ * - #swapcase:: Returns symbol with all upcase characters downcased
+ *               and all downcase characters upcased.
+ * - #to_proc:: Returns a Proc object which responds to the method named by symbol.
+ * - #to_s, #id2name:: Returns the string corresponding to +self+.
+ * - #to_sym, #intern:: Returns +self+.
+ * - #upcase:: Returns symbol with all characters upcased.
+ *
  */
 
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]