diff options
| -rw-r--r-- | doc/string/intern.rdoc | 9 | ||||
| -rw-r--r-- | symbol.c | 16 |
2 files changed, 11 insertions, 14 deletions
diff --git a/doc/string/intern.rdoc b/doc/string/intern.rdoc new file mode 100644 index 0000000000..1336e4688f --- /dev/null +++ b/doc/string/intern.rdoc @@ -0,0 +1,9 @@ +Returns the Symbol object derived from +self+, +creating it if it did not already exist: + + 'foo'.intern # => :foo + 'тест'.intern # => :тест + 'こんにちは'.intern # => :こんにちは + +Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString]. + @@ -927,22 +927,10 @@ rb_gc_free_dsymbol(VALUE sym) /* * call-seq: - * str.intern -> symbol - * str.to_sym -> symbol + * intern -> symbol * - * Returns the +Symbol+ corresponding to <i>str</i>, creating the - * symbol if it did not previously exist. See Symbol#id2name. + * :include: doc/string/intern.rdoc * - * "Koala".intern #=> :Koala - * s = 'cat'.to_sym #=> :cat - * s == :cat #=> true - * s = '@cat'.to_sym #=> :@cat - * s == :@cat #=> true - * - * This can also be used to create symbols that cannot be represented using the - * <code>:xxx</code> notation. - * - * 'cat and dog'.to_sym #=> :"cat and dog" */ VALUE |
