ruby-changes:69528
From: Peter <ko1@a...>
Date: Sat, 30 Oct 2021 10:00:13 +0900 (JST)
Subject: [ruby-changes:69528] 09bdb43567 (master): Clarify docs about magic comments placement
https://git.ruby-lang.org/ruby.git/commit/?id=09bdb43567 From 09bdb43567b0ae3c46180073043136ec8ec0f6a2 Mon Sep 17 00:00:00 2001 From: Peter Leitzen <peter@l...> Date: Mon, 18 Oct 2021 17:33:04 +0200 Subject: 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. --- doc/syntax/comments.rdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/syntax/comments.rdoc b/doc/syntax/comments.rdoc index b361e077b69..dbc78169840 100644 --- a/doc/syntax/comments.rdoc +++ b/doc/syntax/comments.rdoc @@ -41,8 +41,7 @@ syntax error: https://github.com/ruby/ruby/blob/trunk/doc/syntax/comments.rdoc#L41 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. @@ -74,7 +73,8 @@ regexp literals and <code>__ENCODING__</code>: https://github.com/ruby/ruby/blob/trunk/doc/syntax/comments.rdoc#L73 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". -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/