ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
U:RDoc::TopLevel[ i I"syntax/comments.rdoc:ETcRDoc::Parser::Simpleo:RDoc::Markup::Document:@parts[xS:RDoc::Markup::Heading:
leveli: textI"Code Comments;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"6Ruby has two types of comments: inline and block.;T@
o;
;[I"TInline comments start with the # character and continue until the ;TI"end of the line:;T@
o:RDoc::Markup::Verbatim;[I"# On a separate line
;TI"+class Foo # or at the end of the line
;TI" # can be indented
;TI" def bar
;TI" end
;TI" end
;T:@format0o;
;[I"SBlock comments start with =begin and end with =end. ;TI"*Each should start on a separate line.;T@
o;;[I"=begin
;TI"
This is
;TI"commented out
;TI"
=end
;TI"
;TI"class Foo
;TI" end
;TI"
;TI"=begin some_tag
;TI"this works, too
;TI"
=end
;T;0o;
;[I"Q=begin and =end can not be indented, so this is a ;TI"syntax error:;T@
o;;[
I"class Foo
;TI" =begin
;TI" Will not work
;TI" =end
;TI" end
;T;0S; ;
i;I"Magic Comments;T@
o;
;[I"TWhile comments are typically ignored by Ruby, special "magic comments" contain ;TI"8directives that affect how the code is interpreted.;T@
o;
;[I"QTop-level magic comments must appear in the first comment section of a file.;T@
o;
;[I"ENOTE: Magic comments affect only the file in which they appear; ;TI" other files are unaffected.;T@
o;;[ I"## frozen_string_literal: true
;TI"
;TI"var = 'hello'
;TI"var.frozen? # => true
;T;0S; ;
i;I"Alternative syntax;T@
o;
;[I"QMagic comments may consist of a single directive (as in the example above). ;TI"XAlternatively, multiple directives may appear on the same line if separated by ";" ;TI"and wrapped between "-*-" (see Emacs' {file variables}[https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html]).;T@
o;;[ I"W# emacs-compatible; -*- coding: big5; mode: ruby; frozen_string_literal: true -*-
;TI"
;TI"!p 'hello'.frozen? # => true
;TI".p 'hello'.encoding # => #
;T;0S; ;
i;I"+encoding+ Directive;T@
o;
;[I"IIndicates which string encoding should be used for string literals, ;TI"3regexp literals and __ENCODING__:;T@
o;;[I"# encoding: big5
;TI"
;TI"'''.encoding # => #
;T;0o;
;[I"Default encoding is UTF-8.;T@
o;
;[I"UTop-level magic comments must start on the first line, or on the second line if ;TI"8the first line looks like #! shebang line.;T@
o;
;[I"9The word "coding" may be used instead of "encoding".;T@
S; ;
i;I"&+frozen_string_literal+ Directive;T@
o;
;[I"VIndicates that string literals should be allocated once at parse time and frozen.;T@
o;;[I"## frozen_string_literal: true
;TI"
;TI"3.times do
;TI"3 p 'hello'.object_id # => prints same number
;TI" end
;TI"!p 'world'.frozen? # => true
;T;0o;
;[I"aThe default is false; this can be changed with --enable=frozen-string-literal. ;TI"QWithout the directive, or with # frozen_string_literal: false, ;TI"Cthe example above would print 3 different numbers and "false".;T@
o;
;[I"VStarting in Ruby 3.0, string literals that are dynamic are not frozen nor reused:;T@
o;;[I"## frozen_string_literal: true
;TI"
;TI"/p "Addition: #{2 + 2}".frozen? # => false
;T;0o;
;[I";It must appear in the first comment section of a file.;T@
S; ;
i;I"+warn_indent+ Directive;T@
o;
;[I"[This directive can turn on detection of bad indentation for statements that follow it:;T@
o;;[I"
def foo
;TI" end # => no warning
;TI"
;TI"# warn_indent: true
;TI"
def bar
;TI"J end # => warning: mismatched indentations at 'end' with 'def' at 6
;T;0o;
;[I"Another way to get these warnings to show is by running Ruby with warnings (ruby -w). Using a directive to set this false will prevent these warnings to show.;T@
S; ;
i;I")+shareable_constant_value+ Directive;T@
o;
;[I"XNote: This directive is experimental in Ruby 3.0 and may change in future releases.;T@
o;
;[I"This special directive helps to create constants that hold only immutable objects, or {Ractor-shareable}[rdoc-ref:Ractor@Shareable+and+unshareable+objects] constants.;T@
o;
;[I"RThe directive can specify special treatment for values assigned to constants:;T@
o:RDoc::Markup::List:
@type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0;[o;
;[I"+none+: (default);To;;0;[o;
;[I"O+literal+: literals are implicitly frozen, others must be Ractor-shareable;To;;0;[o;
;[I"2+experimental_everything+: all made shareable;To;;0;[o;
;[I";+experimental_copy+: copy deeply and make it shareable;T@
S; ;
i ;I"Mode +none+ (default);T@
o;
;[I"]No special treatment in this mode (as in Ruby 2.x): no automatic freezing and no checks.;T@
o;
;[I"PIt has always been a good idea to deep-freeze constants; Ractor makes this ;TI"Tan even better idea as only the main ractor can access non-shareable constants:;T@
o;;[ I" shareable_constant_value: none
;TI"A = {foo: []}
;TI"A.frozen? # => false
;TI"YRactor.new { puts A } # => can not access non-shareable objects by non-main Ractor.
;T;0S; ;
i ;I"Mode +literal+;T@
o;
;[I"MIn "literal" mode, constants assigned to literals will be deeply-frozen:;T@
o;;[I")# shareable_constant_value: literal
;TI"CX = [{foo: []}] # => same as [{foo: [].freeze}.freeze].freeze
;T;0o;
;[I"$Other values must be shareable:;T@
o;;[I")# shareable_constant_value: literal
;TI"?X = Object.new # => cannot assign unshareable object to X
;T;0o;
;[I"qNote that only literals directly assigned to constants, or recursively held in such literals will be frozen:;T@
o;;[
I")# shareable_constant_value: literal
;TI"var = [{foo: []}]
;TI"Dvar.frozen? # => false (assignment was made to local variable)
;TI"8X = var # => cannot assign unshareable object to X
;TI"
;TI"PX = Set[1, 2, {foo: []}].freeze # => cannot assign unshareable object to X
;TI"H # (`Set[...]` is not a literal and
;TI"O # `{foo: []}` is an argument to `Set.[]`)
;T;0o;
;[I"1The method Module#const_set is not affected.;T@
S; ;
i ;I"#Mode +experimental_everything+;T@
o;
;[I"GIn this mode, all values assigned to constants are made shareable.;T@
o;;[I"9# shareable_constant_value: experimental_everything
;TI" FOO = Set[1, 2, {foo: []}]
;TI"/# same as FOO = Ractor.make_sharable(...)
;TI"D# OR same as `FOO = Set[1, 2, {foo: [].freeze}.freeze].freeze`
;TI"
;TI"var = [{foo: []}]
;TI"Dvar.frozen? # => false (assignment was made to local variable)
;TI"5X = var # => calls `Ractor.make_shareable(var)`
;TI"var.frozen? # => true
;T;0o;
;[I"GThis mode is "experimental", because it might be error prone, for ;TI"Jexample by deep-freezing the constants of an external resource which ;TI"could cause errors:;T@
o;;[I"9# shareable_constant_value: experimental_everything
;TI"#FOO = SomeGem::Something::FOO
;TI"+# => deep freezes the gem's constant!
;T;0o;
;[I"IThis will be revisited before Ruby 3.1 to either allow `everything` ;TI"$or to instead remove this mode.;T@
o;
;[I"1The method Module#const_set is not affected.;T@
S; ;
i ;I"Mode +experimental_copy+;T@
o;
;[I"JIn this mode, all values assigned to constants are deeply copied and ;TI"Emade shareable. It is safer mode than +experimental_everything+.;T@
o;;[I"3# shareable_constant_value: experimental_copy
;TI"var = [{foo: []}]
;TI"Dvar.frozen? # => false (assignment was made to local variable)
;TI"AX = var # => calls `Ractor.make_shareable(var, copy: true)`
;TI"var.frozen? # => false
;TI"#Ractor.shareable?(X) #=> true
;TI",var.object_id == X.object_id #=> false
;T;0o;
;[I"HThis mode is "experimental" and has not been discussed thoroughly. ;TI"CThis will be revisited before Ruby 3.1 to either allow `copy` ;TI"$or to instead remove this mode.;T@
o;
;[I"1The method Module#const_set is not affected.;T@
S; ;
i ;I"
Scope;T@
o;
;[I"@This directive can be used multiple times in the same file:;T@
o;;[I" shareable_constant_value: none
;TI"A = {foo: []}
;TI"A.frozen? # => false
;TI"YRactor.new { puts A } # => can not access non-shareable objects by non-main Ractor.
;TI"
;TI")# shareable_constant_value: literal
;TI"B = {foo: []}
;TI"B.frozen? # => true
;TI"B[:foo].frozen? # => true
;TI"
;TI"ZC = [Object.new] # => cannot assign unshareable object to C (Ractor::IsolationError)
;TI"
;TI"D = [Object.new.freeze]
;TI"D.frozen? # => true
;TI"
;TI"9# shareable_constant_value: experimental_everything
;TI"E = Set[1, 2, Object.new]
;TI"E.frozen? # => true
;TI" E.all(&:frozen?) # => true
;T;0o;
;[I"TThe directive affects only subsequent constants and only for the current scope:;T@
o;;[I"module Mod
;TI"+ # shareable_constant_value: literal
;TI" A = [1, 2, 3]
;TI" module Sub
;TI" B = [4, 5]
;TI" end
;TI" end
;TI"
;TI"C = [4, 5]
;TI"
;TI"module Mod
;TI" D = [6]
;TI" end
;TI";p Mod::A.frozen?, Mod::Sub::B.frozen? # => true, true
;TI"2p C.frozen?, Mod::D.frozen? # => false, false;T;0:
@file@:0@omit_headings_from_table_of_contents_below0