diff options
Diffstat (limited to 'doc/syntax/comments.rdoc')
| -rw-r--r-- | doc/syntax/comments.rdoc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/syntax/comments.rdoc b/doc/syntax/comments.rdoc index 650d13c2dc..cb6829a984 100644 --- a/doc/syntax/comments.rdoc +++ b/doc/syntax/comments.rdoc @@ -41,8 +41,7 @@ syntax error: While comments are typically ignored by Ruby, special "magic comments" contain directives that affect how the code is interpreted. -Top-level magic comments must start on the first line, or on the second line if -the first line looks like <tt>#! shebang line</tt>. +Top-level magic comments must appear in the first comment section of a file. NOTE: Magic comments affect only the file in which they appear; other files are unaffected. @@ -58,7 +57,7 @@ Magic comments may consist of a single directive (as in the example above). Alternatively, multiple directives may appear on the same line if separated by ";" and wrapped between "-*-" (see Emacs' {file variables}[https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html]). - # emacs-compatible; -*- coding: big5; mode: ruby -*- + # emacs-compatible; -*- coding: big5; mode: ruby; frozen_string_literal: true -*- p 'hello'.frozen? # => true p 'hello'.encoding # => #<Encoding:Big5> @@ -74,7 +73,8 @@ regexp literals and <code>__ENCODING__</code>: Default encoding is UTF-8. -It must appear in the first comment section of a file. +Top-level magic comments must start on the first line, or on the second line if +the first line looks like <tt>#! shebang line</tt>. The word "coding" may be used instead of "encoding". @@ -170,7 +170,7 @@ In this mode, all values assigned to constants are made shareable. # shareable_constant_value: experimental_everything FOO = Set[1, 2, {foo: []}] - # same as FOO = Ractor.make_sharable(...) + # same as FOO = Ractor.make_shareable(...) # OR same as `FOO = Set[1, 2, {foo: [].freeze}.freeze].freeze` var = [{foo: []}] @@ -196,7 +196,7 @@ The method Module#const_set is not affected. In this mode, all values assigned to constants are deeply copied and made shareable. It is safer mode than +experimental_everything+. - # shareable_constant_value: experimental_everything + # shareable_constant_value: experimental_copy var = [{foo: []}] var.frozen? # => false (assignment was made to local variable) X = var # => calls `Ractor.make_shareable(var, copy: true)` |
