diff options
author | zverok <[email protected]> | 2020-12-17 00:49:52 +0200 |
---|---|---|
committer | Marc-André Lafortune <[email protected]> | 2020-12-21 19:22:38 -0500 |
commit | 4728c0d900f40036757d869fd5f20673c563bac7 (patch) | |
tree | 44d7b71906dfa07ba2d55eb905e75a22b9c544ac /string.c | |
parent | 4a18cc7f604c259415d933acd9fd00234733cab6 (diff) |
Add Symbol#name and freezing explanation to #to_s
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3966
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -11052,6 +11052,26 @@ sym_inspect(VALUE sym) return str; } +#if 0 /* for RDoc */ +/* + * call-seq: + * sym.name -> string + * + * Returns the name or string corresponding to <i>sym</i>. Unlike #to_s, the + * returned string is frozen. + * + * :fred.name #=> "fred" + * :fred.name.frozen? #=> true + * :fred.to_s #=> "fred" + * :fred.to_s.frozen? #=> false + */ +VALUE +rb_sym2str(VALUE sym) +{ + +} +#endif + /* * call-seq: @@ -11062,6 +11082,9 @@ sym_inspect(VALUE sym) * * :fred.id2name #=> "fred" * :ginger.to_s #=> "ginger" + * + * Note that this string is not frozen (unlike the symbol itself). + * To get a frozen string, use #name. */ |