Clarify docs about magic comments placement
Magic comments like `frozen_string_literal` may appear everywhere within the first comment section while `encoding` have to be the first line, or second line after shebang.
This commit is contained in:
parent
f634d1ee00
commit
09bdb43567
Notes:
git
2021-10-30 10:00:25 +09:00
@ -41,8 +41,7 @@ syntax error:
|
|||||||
While comments are typically ignored by Ruby, special "magic comments" contain
|
While comments are typically ignored by Ruby, special "magic comments" contain
|
||||||
directives that affect how the code is interpreted.
|
directives that affect how the code is interpreted.
|
||||||
|
|
||||||
Top-level magic comments must start on the first line, or on the second line if
|
Top-level magic comments must appear in the first comment section of a file.
|
||||||
the first line looks like <tt>#! shebang line</tt>.
|
|
||||||
|
|
||||||
NOTE: Magic comments affect only the file in which they appear;
|
NOTE: Magic comments affect only the file in which they appear;
|
||||||
other files are unaffected.
|
other files are unaffected.
|
||||||
@ -74,7 +73,8 @@ regexp literals and <code>__ENCODING__</code>:
|
|||||||
|
|
||||||
Default encoding is UTF-8.
|
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".
|
The word "coding" may be used instead of "encoding".
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user