summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-11-14 15:39:10 +0900
committerNobuyoshi Nakada <[email protected]>2023-11-14 15:56:58 +0900
commit19a7a7660c34c862689f99b4f9b0447be92cbffb (patch)
tree679adb8ee56d4f9d23e2f0199b2c9cb6da73d98c /doc
parentcaa9881fde884238e38c2decea97ecfca559280c (diff)
[DOC] Adjust heading levels
So that the first headings would be the top-most headings.
Diffstat (limited to 'doc')
-rw-r--r--doc/bsearch.rdoc2
-rw-r--r--doc/case_mapping.rdoc6
-rw-r--r--doc/character_selectors.rdoc6
-rw-r--r--doc/command_injection.rdoc2
-rw-r--r--doc/encodings.rdoc38
-rw-r--r--doc/format_specifications.rdoc58
-rw-r--r--doc/globals.rdoc126
-rw-r--r--doc/implicit_conversion.rdoc10
-rw-r--r--doc/keywords.rdoc2
-rw-r--r--doc/packed_data.rdoc44
-rw-r--r--doc/strftime_formatting.rdoc48
-rw-r--r--doc/timezones.rdoc12
12 files changed, 177 insertions, 177 deletions
diff --git a/doc/bsearch.rdoc b/doc/bsearch.rdoc
index ca8091fc0d..90705853d7 100644
--- a/doc/bsearch.rdoc
+++ b/doc/bsearch.rdoc
@@ -1,4 +1,4 @@
-== Binary Searching
+= Binary Searching
A few Ruby methods support binary searching in a collection:
diff --git a/doc/case_mapping.rdoc b/doc/case_mapping.rdoc
index 3c42154973..57c037b9d8 100644
--- a/doc/case_mapping.rdoc
+++ b/doc/case_mapping.rdoc
@@ -1,4 +1,4 @@
-== Case Mapping
+= Case Mapping
Some string-oriented methods use case mapping.
@@ -24,7 +24,7 @@ In Symbol:
- Symbol#swapcase
- Symbol#upcase
-=== Default Case Mapping
+== Default Case Mapping
By default, all of these methods use full Unicode case mapping,
which is suitable for most languages.
@@ -60,7 +60,7 @@ Case changes may not be reversible:
Case changing methods may not maintain Unicode normalization.
See String#unicode_normalize).
-=== Options for Case Mapping
+== Options for Case Mapping
Except for +casecmp+ and +casecmp?+,
each of the case-mapping methods listed above
diff --git a/doc/character_selectors.rdoc b/doc/character_selectors.rdoc
index e01b0e6a25..47cf242be7 100644
--- a/doc/character_selectors.rdoc
+++ b/doc/character_selectors.rdoc
@@ -1,6 +1,6 @@
-== Character Selectors
+= Character Selectors
-=== Character Selector
+== Character Selector
A _character_ _selector_ is a string argument accepted by certain Ruby methods.
Each of these instance methods accepts one or more character selectors:
@@ -70,7 +70,7 @@ In a character selector, these three characters get special treatment:
"hello\r\nworld".delete("\\r") # => "hello\r\nwold"
"hello\r\nworld".delete("\\\r") # => "hello\nworld"
-=== Multiple Character Selectors
+== Multiple Character Selectors
These instance methods accept multiple character selectors:
diff --git a/doc/command_injection.rdoc b/doc/command_injection.rdoc
index 4408b1839d..246b2e6afe 100644
--- a/doc/command_injection.rdoc
+++ b/doc/command_injection.rdoc
@@ -1,4 +1,4 @@
-== Command Injection
+= Command Injection
Some Ruby core methods accept string data
that includes text to be executed as a system command.
diff --git a/doc/encodings.rdoc b/doc/encodings.rdoc
index 914f5d3afa..97c0d22616 100644
--- a/doc/encodings.rdoc
+++ b/doc/encodings.rdoc
@@ -1,6 +1,6 @@
-== Encodings
+= Encodings
-=== The Basics
+== The Basics
A {character encoding}[https://en.wikipedia.org/wiki/Character_encoding],
often shortened to _encoding_, is a mapping between:
@@ -30,9 +30,9 @@ Other characters, such as the Euro symbol, are multi-byte:
s = "\u20ac" # => "€"
s.bytes # => [226, 130, 172]
-=== The \Encoding \Class
+== The \Encoding \Class
-==== \Encoding Objects
+=== \Encoding Objects
Ruby encodings are defined by constants in class \Encoding.
There can be only one instance of \Encoding for each of these constants.
@@ -43,7 +43,7 @@ There can be only one instance of \Encoding for each of these constants.
Encoding.list.take(3)
# => [#<Encoding:ASCII-8BIT>, #<Encoding:UTF-8>, #<Encoding:US-ASCII>]
-==== Names and Aliases
+=== Names and Aliases
\Method Encoding#name returns the name of an \Encoding:
@@ -78,7 +78,7 @@ because it includes both the names and their aliases.
Encoding.find("US-ASCII") # => #<Encoding:US-ASCII>
Encoding.find("US-ASCII").class # => Encoding
-==== Default Encodings
+=== Default Encodings
\Method Encoding.find, above, also returns a default \Encoding
for each of these special names:
@@ -118,7 +118,7 @@ for each of these special names:
Encoding.default_internal = 'US-ASCII' # => "US-ASCII"
Encoding.default_internal # => #<Encoding:US-ASCII>
-==== Compatible Encodings
+=== Compatible Encodings
\Method Encoding.compatible? returns whether two given objects are encoding-compatible
(that is, whether they can be concatenated);
@@ -132,7 +132,7 @@ returns the \Encoding of the concatenated string, or +nil+ if incompatible:
s1 = "\xa1\xa1".force_encoding('euc-jp') # => "\x{A1A1}"
Encoding.compatible?(s0, s1) # => nil
-=== \String \Encoding
+== \String \Encoding
A Ruby String object has an encoding that is an instance of class \Encoding.
The encoding may be retrieved by method String#encoding.
@@ -183,7 +183,7 @@ Here are a couple of useful query methods:
s = "\xc2".force_encoding("UTF-8") # => "\xC2"
s.valid_encoding? # => false
-=== \Symbol and \Regexp Encodings
+== \Symbol and \Regexp Encodings
The string stored in a Symbol or Regexp object also has an encoding;
the encoding may be retrieved by method Symbol#encoding or Regexp#encoding.
@@ -194,20 +194,20 @@ The default encoding for these, however, is:
- The script encoding, otherwise;
see (Script Encoding)[rdoc-ref:encodings.rdoc@Script+Encoding].
-=== Filesystem \Encoding
+== Filesystem \Encoding
The filesystem encoding is the default \Encoding for a string from the filesystem:
Encoding.find("filesystem") # => #<Encoding:UTF-8>
-=== Locale \Encoding
+== Locale \Encoding
The locale encoding is the default encoding for a string from the environment,
other than from the filesystem:
Encoding.find('locale') # => #<Encoding:IBM437>
-=== Stream Encodings
+== Stream Encodings
Certain stream objects can have two encodings; these objects include instances of:
@@ -222,7 +222,7 @@ The two encodings are:
- An _internal_ _encoding_, which (if not +nil+) specifies the encoding
to be used for the string constructed from the stream.
-==== External \Encoding
+=== External \Encoding
The external encoding, which is an \Encoding object, specifies how bytes read
from the stream are to be interpreted as characters.
@@ -250,7 +250,7 @@ For an \IO, \File, \ARGF, or \StringIO object, the external encoding may be set
- \Methods +set_encoding+ or (except for \ARGF) +set_encoding_by_bom+.
-==== Internal \Encoding
+=== Internal \Encoding
The internal encoding, which is an \Encoding object or +nil+,
specifies how characters read from the stream
@@ -276,7 +276,7 @@ For an \IO, \File, \ARGF, or \StringIO object, the internal encoding may be set
- \Method +set_encoding+.
-=== Script \Encoding
+== Script \Encoding
A Ruby script has a script encoding, which may be retrieved by:
@@ -291,7 +291,7 @@ followed by a colon, space and the Encoding name or alias:
# encoding: ISO-8859-1
__ENCODING__ #=> #<Encoding:ISO-8859-1>
-=== Transcoding
+== Transcoding
_Transcoding_ is the process of changing a sequence of characters
from one encoding to another.
@@ -302,7 +302,7 @@ but the bytes that represent them may change.
The handling for characters that cannot be represented in the destination encoding
may be specified by @Encoding+Options.
-==== Transcoding a \String
+=== Transcoding a \String
Each of these methods transcodes a string:
@@ -317,7 +317,7 @@ Each of these methods transcodes a string:
- String#unicode_normalize!: Like String#unicode_normalize,
but transcodes +self+ in place.
-=== Transcoding a Stream
+== Transcoding a Stream
Each of these methods may transcode a stream;
whether it does so depends on the external and internal encodings:
@@ -352,7 +352,7 @@ Output:
"R\xE9sum\xE9"
"Résumé"
-=== \Encoding Options
+== \Encoding Options
A number of methods in the Ruby core accept keyword arguments as encoding options.
diff --git a/doc/format_specifications.rdoc b/doc/format_specifications.rdoc
index e589524f27..1111575e74 100644
--- a/doc/format_specifications.rdoc
+++ b/doc/format_specifications.rdoc
@@ -1,4 +1,4 @@
-== Format Specifications
+= Format Specifications
Several Ruby core classes have instance method +printf+ or +sprintf+:
@@ -37,12 +37,12 @@ It consists of:
Except for the leading percent character,
the only required part is the type specifier, so we begin with that.
-=== Type Specifiers
+== Type Specifiers
This section provides a brief explanation of each type specifier.
The links lead to the details and examples.
-==== \Integer Type Specifiers
+=== \Integer Type Specifiers
- +b+ or +B+: Format +argument+ as a binary integer.
See {Specifiers b and B}[rdoc-ref:format_specifications.rdoc@Specifiers+b+and+B].
@@ -54,7 +54,7 @@ The links lead to the details and examples.
- +x+ or +X+: Format +argument+ as a hexadecimal integer.
See {Specifiers x and X}[rdoc-ref:format_specifications.rdoc@Specifiers+x+and+X].
-==== Floating-Point Type Specifiers
+=== Floating-Point Type Specifiers
- +a+ or +A+: Format +argument+ as hexadecimal floating-point number.
See {Specifiers a and A}[rdoc-ref:format_specifications.rdoc@Specifiers+a+and+A].
@@ -65,7 +65,7 @@ The links lead to the details and examples.
- +g+ or +G+: Format +argument+ in a "general" format.
See {Specifiers g and G}[rdoc-ref:format_specifications.rdoc@Specifiers+g+and+G].
-==== Other Type Specifiers
+=== Other Type Specifiers
- +c+: Format +argument+ as a character.
See {Specifier c}[rdoc-ref:format_specifications.rdoc@Specifier+c].
@@ -76,7 +76,7 @@ The links lead to the details and examples.
- <tt>%</tt>: Format +argument+ (<tt>'%'</tt>) as a single percent character.
See {Specifier %}[rdoc-ref:format_specifications.rdoc@Specifier+-25].
-=== Flags
+== Flags
The effect of a flag may vary greatly among type specifiers.
These remarks are general in nature.
@@ -85,7 +85,7 @@ See {type-specific details}[rdoc-ref:format_specifications.rdoc@Type+Specifier+D
Multiple flags may be given with single type specifier;
order does not matter.
-==== <tt>' '</tt> Flag
+=== <tt>' '</tt> Flag
Insert a space before a non-negative number:
@@ -97,49 +97,49 @@ Insert a minus sign for negative value:
sprintf('%d', -10) # => "-10"
sprintf('% d', -10) # => "-10"
-==== <tt>'#'</tt> Flag
+=== <tt>'#'</tt> Flag
Use an alternate format; varies among types:
sprintf('%x', 100) # => "64"
sprintf('%#x', 100) # => "0x64"
-==== <tt>'+'</tt> Flag
+=== <tt>'+'</tt> Flag
Add a leading plus sign for a non-negative number:
sprintf('%x', 100) # => "64"
sprintf('%+x', 100) # => "+64"
-==== <tt>'-'</tt> Flag
+=== <tt>'-'</tt> Flag
Left justify the value in its field:
sprintf('%6d', 100) # => " 100"
sprintf('%-6d', 100) # => "100 "
-==== <tt>'0'</tt> Flag
+=== <tt>'0'</tt> Flag
Left-pad with zeros instead of spaces:
sprintf('%6d', 100) # => " 100"
sprintf('%06d', 100) # => "000100"
-==== <tt>'*'</tt> Flag
+=== <tt>'*'</tt> Flag
Use the next argument as the field width:
sprintf('%d', 20, 14) # => "20"
sprintf('%*d', 20, 14) # => " 14"
-==== <tt>'n$'</tt> Flag
+=== <tt>'n$'</tt> Flag
Format the (1-based) <tt>n</tt>th argument into this field:
sprintf("%s %s", 'world', 'hello') # => "world hello"
sprintf("%2$s %1$s", 'world', 'hello') # => "hello world"
-=== Width Specifier
+== Width Specifier
In general, a width specifier determines the minimum width (in characters)
of the formatted field:
@@ -152,7 +152,7 @@ of the formatted field:
# Ignore if too small.
sprintf('%1d', 100) # => "100"
-=== Precision Specifier
+== Precision Specifier
A precision specifier is a decimal point followed by zero or more
decimal digits.
@@ -194,9 +194,9 @@ the number of characters to write:
sprintf('%s', Time.now) # => "2022-05-04 11:59:16 -0400"
sprintf('%.10s', Time.now) # => "2022-05-04"
-=== Type Specifier Details and Examples
+== Type Specifier Details and Examples
-==== Specifiers +a+ and +A+
+=== Specifiers +a+ and +A+
Format +argument+ as hexadecimal floating-point number:
@@ -209,7 +209,7 @@ Format +argument+ as hexadecimal floating-point number:
sprintf('%A', 4096) # => "0X1P+12"
sprintf('%A', -4096) # => "-0X1P+12"
-==== Specifiers +b+ and +B+
+=== Specifiers +b+ and +B+
The two specifiers +b+ and +B+ behave identically
except when flag <tt>'#'</tt>+ is used.
@@ -226,14 +226,14 @@ Format +argument+ as a binary integer:
sprintf('%#b', 4) # => "0b100"
sprintf('%#B', 4) # => "0B100"
-==== Specifier +c+
+=== Specifier +c+
Format +argument+ as a single character:
sprintf('%c', 'A') # => "A"
sprintf('%c', 65) # => "A"
-==== Specifier +d+
+=== Specifier +d+
Format +argument+ as a decimal integer:
@@ -242,7 +242,7 @@ Format +argument+ as a decimal integer:
Flag <tt>'#'</tt> does not apply.
-==== Specifiers +e+ and +E+
+=== Specifiers +e+ and +E+
Format +argument+ in
{scientific notation}[https://en.wikipedia.org/wiki/Scientific_notation]:
@@ -250,7 +250,7 @@ Format +argument+ in
sprintf('%e', 3.14159) # => "3.141590e+00"
sprintf('%E', -3.14159) # => "-3.141590E+00"
-==== Specifier +f+
+=== Specifier +f+
Format +argument+ as a floating-point number:
@@ -259,7 +259,7 @@ Format +argument+ as a floating-point number:
Flag <tt>'#'</tt> does not apply.
-==== Specifiers +g+ and +G+
+=== Specifiers +g+ and +G+
Format +argument+ using exponential form (+e+/+E+ specifier)
if the exponent is less than -4 or greater than or equal to the precision.
@@ -281,7 +281,7 @@ Otherwise format +argument+ using floating-point form (+f+ specifier):
sprintf('%#G', 100000000000) # => "1.00000E+11"
sprintf('%#G', 0.000000000001) # => "1.00000E-12"
-==== Specifier +o+
+=== Specifier +o+
Format +argument+ as an octal integer.
If +argument+ is negative, it will be formatted as a two's complement
@@ -296,14 +296,14 @@ prefixed with +..7+:
sprintf('%#o', 16) # => "020"
sprintf('%#o', -16) # => "..760"
-==== Specifier +p+
+=== Specifier +p+
Format +argument+ as a string via <tt>argument.inspect</tt>:
t = Time.now
sprintf('%p', t) # => "2022-05-01 13:42:07.1645683 -0500"
-==== Specifier +s+
+=== Specifier +s+
Format +argument+ as a string via <tt>argument.to_s</tt>:
@@ -312,7 +312,7 @@ Format +argument+ as a string via <tt>argument.to_s</tt>:
Flag <tt>'#'</tt> does not apply.
-==== Specifiers +x+ and +X+
+=== Specifiers +x+ and +X+
Format +argument+ as a hexadecimal integer.
If +argument+ is negative, it will be formatted as a two's complement
@@ -329,7 +329,7 @@ prefixed with +..f+:
# Alternate format for negative value.
sprintf('%#x', -100) # => "0x..f9c"
-==== Specifier <tt>%</tt>
+=== Specifier <tt>%</tt>
Format +argument+ (<tt>'%'</tt>) as a single percent character:
@@ -337,7 +337,7 @@ Format +argument+ (<tt>'%'</tt>) as a single percent character:
Flags do not apply.
-=== Reference by Name
+== Reference by Name
For more complex formatting, Ruby supports a reference by name.
%<name>s style uses format style, but %{name} style doesn't.
diff --git a/doc/globals.rdoc b/doc/globals.rdoc
index 2b4f6bd7cf..3ffe1ada5d 100644
--- a/doc/globals.rdoc
+++ b/doc/globals.rdoc
@@ -1,4 +1,4 @@
-== Pre-Defined Global Variables
+= Pre-Defined Global Variables
Some of the pre-defined global variables have synonyms
that are available via module Engish.
@@ -8,9 +8,9 @@ To use the module:
require 'English'
-=== Exceptions
+== Exceptions
-==== <tt>$!</tt> (\Exception)
+=== <tt>$!</tt> (\Exception)
Contains the Exception object set by Kernel#raise:
@@ -26,7 +26,7 @@ Output:
English - <tt>$ERROR_INFO</tt>
-==== <tt>$@</tt> (Backtrace)
+=== <tt>$@</tt> (Backtrace)
Same as <tt>$!.backtrace</tt>;
returns an array of backtrace positions:
@@ -46,7 +46,7 @@ Output:
English - <tt>$ERROR_POSITION</tt>.
-=== Pattern Matching
+== Pattern Matching
These global variables store information about the most recent
successful match in the current scope.
@@ -54,46 +54,46 @@ successful match in the current scope.
For details and examples,
see {Regexp Global Variables}[rdoc-ref:Regexp@Global+Variables].
-==== <tt>$~</tt> (\MatchData)
+=== <tt>$~</tt> (\MatchData)
MatchData object created from the match;
thread-local and frame-local.
English - <tt>$LAST_MATCH_INFO</tt>.
-==== <tt>$&</tt> (Matched Substring)
+=== <tt>$&</tt> (Matched Substring)
The matched string.
English - <tt>$MATCH</tt>.
-==== <tt>$`</tt> (Pre-Match Substring)
+=== <tt>$`</tt> (Pre-Match Substring)
The string to the left of the match.
English - <tt>$PREMATCH</tt>.
-==== <tt>$'</tt> (Post-Match Substring)
+=== <tt>$'</tt> (Post-Match Substring)
The string to the right of the match.
English - <tt>$POSTMATCH</tt>.
-==== <tt>$+</tt> (Last Matched Group)
+=== <tt>$+</tt> (Last Matched Group)
The last group matched.
English - <tt>$LAST_PAREN_MATCH</tt>.
-==== <tt>$1</tt>, <tt>$2</tt>, \Etc. (Matched Group)
+=== <tt>$1</tt>, <tt>$2</tt>, \Etc. (Matched Group)
For <tt>$_n_</tt> the _nth_ group of the match.
No \English.
-=== Separators
+== Separators
-==== <tt>$/</tt> (Input Record Separator)
+=== <tt>$/</tt> (Input Record Separator)
An input record separator, initially newline.
@@ -101,7 +101,7 @@ English - <tt>$INPUT_RECORD_SEPARATOR</tt>, <tt>$RS</tt>.
Aliased as <tt>$-0</tt>.
-==== <tt>$;</tt> (Input Field Separator)
+=== <tt>$;</tt> (Input Field Separator)
An input field separator, initially +nil+.
@@ -109,76 +109,76 @@ English - <tt>$FIELD_SEPARATOR</tt>, <tt>$FS</tt>.
Aliased as <tt>$-F</tt>.
-==== <tt>$\\</tt> (Output Record Separator)
+=== <tt>$\\</tt> (Output Record Separator)
An output record separator, initially +nil+.
English - <tt>$OUTPUT_RECORD_SEPARATOR</tt>, <tt>$ORS</tt>.
-=== Streams
+== Streams
-==== <tt>$stdin</tt> (Standard Input)
+=== <tt>$stdin</tt> (Standard Input)
The current standard input stream; initially:
$stdin # => #<IO:<STDIN>>
-==== <tt>$stdout</tt> (Standard Output)
+=== <tt>$stdout</tt> (Standard Output)
The current standard output stream; initially:
$stdout # => #<IO:<STDOUT>>
-==== <tt>$stderr</tt> (Standard Error)
+=== <tt>$stderr</tt> (Standard Error)
The current standard error stream; initially:
$stderr # => #<IO:<STDERR>>
-==== <tt>$<</tt> (\ARGF or $stdin)
+=== <tt>$<</tt> (\ARGF or $stdin)
Points to stream ARGF if not empty, else to stream $stdin; read-only.
English - <tt>$DEFAULT_INPUT</tt>.
-==== <tt>$></tt> (Default Standard Output)
+=== <tt>$></tt> (Default Standard Output)
An output stream, initially <tt>$stdout</tt>.
English - <tt>$DEFAULT_OUTPUT
-==== <tt>$.</tt> (Input Position)
+=== <tt>$.</tt> (Input Position)
The input position (line number) in the most recently read stream.
English - <tt>$INPUT_LINE_NUMBER</tt>, <tt>$NR</tt>
-==== <tt>$_</tt> (Last Read Line)
+=== <tt>$_</tt> (Last Read Line)
The line (string) from the most recently read stream.
English - <tt>$LAST_READ_LINE</tt>.
-=== Processes
+== Processes
-==== <tt>$0</tt>
+=== <tt>$0</tt>
Initially, contains the name of the script being executed;
may be reassigned.
-==== <tt>$*</tt> (\ARGV)
+=== <tt>$*</tt> (\ARGV)
Points to ARGV.
English - <tt>$ARGV</tt>.
-==== <tt>$$</tt> (Process ID)
+=== <tt>$$</tt> (Process ID)
The process ID of the current process. Same as Process.pid.
English - <tt>$PROCESS_ID</tt>, <tt>$PID</tt>.
-==== <tt>$?</tt> (Child Status)
+=== <tt>$?</tt> (Child Status)
Initially +nil+, otherwise the Process::Status object
created for the most-recently exited child process;
@@ -186,7 +186,7 @@ thread-local.
English - <tt>$CHILD_STATUS</tt>.
-==== <tt>$LOAD_PATH</tt> (Load Path)
+=== <tt>$LOAD_PATH</tt> (Load Path)
Contains the array of paths to be searched
by Kernel#load and Kernel#require.
@@ -211,7 +211,7 @@ Examples:
Aliased as <tt>$:</tt> and <tt>$-I</tt>.
-==== <tt>$LOADED_FEATURES</tt>
+=== <tt>$LOADED_FEATURES</tt>
Contains an array of the paths to the loaded files:
@@ -230,13 +230,13 @@ Contains an array of the paths to the loaded files:
Aliased as <tt>$"</tt>.
-=== Debugging
+== Debugging
-==== <tt>$FILENAME</tt>
+=== <tt>$FILENAME</tt>
The value returned by method ARGF.filename.
-==== <tt>$DEBUG</tt>
+=== <tt>$DEBUG</tt>
Initially +true+ if command-line option <tt>-d</tt> or <tt>--debug</tt> is given,
otherwise initially +false+;
@@ -246,7 +246,7 @@ When +true+, prints each raised exception to <tt>$stderr</tt>.
Aliased as <tt>$-d</tt>.
-==== <tt>$VERBOSE</tt>
+=== <tt>$VERBOSE</tt>
Initially +true+ if command-line option <tt>-v</tt> or <tt>-w</tt> is given,
otherwise initially +false+;
@@ -258,58 +258,58 @@ When +nil+, disables warnings, including those from Kernel#warn.
Aliased as <tt>$-v</tt> and <tt>$-w</tt>.
-=== Other Variables
+== Other Variables
-==== <tt>$-a</tt>
+=== <tt>$-a</tt>
Whether command-line option <tt>-a</tt> was given; read-only.
-==== <tt>$-i</tt>
+=== <tt>$-i</tt>
Contains the extension given with command-line option <tt>-i</tt>,
or +nil+ if none.
An alias of ARGF.inplace_mode.
-==== <tt>$-l</tt>
+=== <tt>$-l</tt>
Whether command-line option <tt>-l</tt> was set; read-only.
-==== <tt>$-p</tt>
+=== <tt>$-p</tt>
Whether command-line option <tt>-p</tt> was given; read-only.
-=== Deprecated
+== Deprecated
-==== <tt>$=</tt>
+=== <tt>$=</tt>
-==== <tt>$,</tt>
+=== <tt>$,</tt>
-== Pre-Defined Global Constants
+= Pre-Defined Global Constants
-== Streams
+= Streams
-==== <tt>STDIN</tt>
+=== <tt>STDIN</tt>
The standard input stream (the default value for <tt>$stdin</tt>):
STDIN # => #<IO:<STDIN>>
-==== <tt>STDOUT</tt>
+=== <tt>STDOUT</tt>
The standard output stream (the default value for <tt>$stdout</tt>):
STDOUT # => #<IO:<STDOUT>>
-==== <tt>STDERR</tt>
+=== <tt>STDERR</tt>
The standard error stream (the default value for <tt>$stderr</tt>):
STDERR # => #<IO:<STDERR>>
-=== Enviroment
+== Enviroment
-==== ENV
+=== ENV
A hash of the contains current environment variables names and values:
@@ -321,41 +321,41 @@ A hash of the contains current environment variables names and values:
["DISPLAY", ":0"],
["GDMSESSION", "ubuntu"]]
-==== ARGF
+=== ARGF
The virtual concatenation of the files given on the command line, or from
<tt>$stdin</tt> if no files were given, <tt>"-"</tt> is given, or after
all files have been read.
-==== <tt>ARGV</tt>
+=== <tt>ARGV</tt>
An array of the given command-line arguments.
-==== <tt>TOPLEVEL_BINDING</tt>
+=== <tt>TOPLEVEL_BINDING</tt>
The Binding of the top level scope:
TOPLEVEL_BINDING # => #<Binding:0x00007f58da0da7c0>
-==== <tt>RUBY_VERSION</tt>
+=== <tt>RUBY_VERSION</tt>
The Ruby version:
RUBY_VERSION # => "3.2.2"
-==== <tt>RUBY_RELEASE_DATE</tt>
+=== <tt>RUBY_RELEASE_DATE</tt>
The release date string:
RUBY_RELEASE_DATE # => "2023-03-30"
-==== <tt>RUBY_PLATFORM</tt>
+=== <tt>RUBY_PLATFORM</tt>
The platform identifier:
RUBY_PLATFORM # => "x86_64-linux"
-==== <tt>RUBY_PATCHLEVEL</tt>
+=== <tt>RUBY_PATCHLEVEL</tt>
The integer patch level for this Ruby:
@@ -363,41 +363,41 @@ The integer patch level for this Ruby:
For a development build the patch level will be -1.
-==== <tt>RUBY_REVISION</tt>
+=== <tt>RUBY_REVISION</tt>
The git commit hash for this Ruby:
RUBY_REVISION # => "e51014f9c05aa65cbf203442d37fef7c12390015"
-==== <tt>RUBY_COPYRIGHT</tt>
+=== <tt>RUBY_COPYRIGHT</tt>
The copyright string:
RUBY_COPYRIGHT
# => "ruby - Copyright (C) 1993-2023 Yukihiro Matsumoto"
-==== <tt>RUBY_ENGINE</tt>
+=== <tt>RUBY_ENGINE</tt>
The name of the Ruby implementation:
RUBY_ENGINE # => "ruby"
-==== <tt>RUBY_ENGINE_VERSION</tt>
+=== <tt>RUBY_ENGINE_VERSION</tt>
The version of the Ruby implementation:
RUBY_ENGINE_VERSION # => "3.2.2"
-==== <tt>RUBY_DESCRIPTION</tt>
+=== <tt>RUBY_DESCRIPTION</tt>
The description of the Ruby implementation:
RUBY_DESCRIPTION
# => "ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]"
-=== Embedded \Data
+== Embedded \Data
-==== <tt>DATA</tt>
+=== <tt>DATA</tt>
Defined if and only if the program has this line:
diff --git a/doc/implicit_conversion.rdoc b/doc/implicit_conversion.rdoc
index ba15fa4bf4..e244096125 100644
--- a/doc/implicit_conversion.rdoc
+++ b/doc/implicit_conversion.rdoc
@@ -1,4 +1,4 @@
-== Implicit Conversions
+= Implicit Conversions
Some Ruby methods accept one or more objects
that can be either:
@@ -15,7 +15,7 @@ a specific conversion method:
* Integer: +to_int+
* String: +to_str+
-=== Array-Convertible Objects
+== Array-Convertible Objects
An <i>Array-convertible object</i> is an object that:
@@ -69,7 +69,7 @@ This class is not Array-convertible (method +to_ary+ returns non-Array):
# Raises TypeError (can't convert NotArrayConvertible to Array (NotArrayConvertible#to_ary gives Symbol))
a.replace(NotArrayConvertible.new)
-=== Hash-Convertible Objects
+== Hash-Convertible Objects
A <i>Hash-convertible object</i> is an object that:
@@ -123,7 +123,7 @@ This class is not Hash-convertible (method +to_hash+ returns non-Hash):
# Raises TypeError (can't convert NotHashConvertible to Hash (ToHashReturnsNonHash#to_hash gives Symbol))
h.merge(NotHashConvertible.new)
-=== Integer-Convertible Objects
+== Integer-Convertible Objects
An <i>Integer-convertible object</i> is an object that:
@@ -171,7 +171,7 @@ This class is not Integer-convertible (method +to_int+ returns non-Integer):
# Raises TypeError (can't convert NotIntegerConvertible to Integer (NotIntegerConvertible#to_int gives Symbol))
Array.new(NotIntegerConvertible.new)
-=== String-Convertible Objects
+== String-Convertible Objects
A <i>String-convertible object</i> is an object that:
* Has instance method +to_str+.
diff --git a/doc/keywords.rdoc b/doc/keywords.rdoc
index cb1cff33f0..7c368205ef 100644
--- a/doc/keywords.rdoc
+++ b/doc/keywords.rdoc
@@ -1,4 +1,4 @@
-== Keywords
+= Keywords
The following keywords are used by Ruby.
diff --git a/doc/packed_data.rdoc b/doc/packed_data.rdoc
index bd71d13373..59d8c99a3a 100644
--- a/doc/packed_data.rdoc
+++ b/doc/packed_data.rdoc
@@ -1,4 +1,4 @@
-== Packed \Data
+= Packed \Data
Certain Ruby core methods deal with packing and unpacking data:
@@ -64,7 +64,7 @@ If elements don't fit the provided directive, only least significant bits are en
[257].pack("C").unpack("C") # => [1]
-=== Packing \Method
+== Packing \Method
\Method Array#pack accepts optional keyword argument
+buffer+ that specifies the target string (instead of a new string):
@@ -76,7 +76,7 @@ The method can accept a block:
# Packed string is passed to the block.
[65, 66].pack('C*') {|s| p s } # => "AB"
-=== Unpacking Methods
+== Unpacking Methods
Methods String#unpack and String#unpack1 each accept
an optional keyword argument +offset+ that specifies an offset
@@ -95,12 +95,12 @@ Both methods can accept a block:
# The single unpacked object is passed to the block.
'AB'.unpack1('C*') {|ele| p ele } # => 65
-=== \Integer Directives
+== \Integer Directives
Each integer directive specifies the packing or unpacking
for one element in the input or output array.
-==== 8-Bit \Integer Directives
+=== 8-Bit \Integer Directives
- <tt>'c'</tt> - 8-bit signed integer
(like C <tt>signed char</tt>):
@@ -116,7 +116,7 @@ for one element in the input or output array.
s = [0, 1, -1].pack('C*') # => "\x00\x01\xFF"
s.unpack('C*') # => [0, 1, 255]
-==== 16-Bit \Integer Directives
+=== 16-Bit \Integer Directives
- <tt>'s'</tt> - 16-bit signed integer, native-endian
(like C <tt>int16_t</tt>):
@@ -146,7 +146,7 @@ for one element in the input or output array.
s.unpack('v*')
# => [0, 1, 65535, 32767, 32768, 65535]
-==== 32-Bit \Integer Directives
+=== 32-Bit \Integer Directives
- <tt>'l'</tt> - 32-bit signed integer, native-endian
(like C <tt>int32_t</tt>):
@@ -178,7 +178,7 @@ for one element in the input or output array.
s.unpack('v*')
# => [0, 0, 1, 0, 65535, 65535]
-==== 64-Bit \Integer Directives
+=== 64-Bit \Integer Directives
- <tt>'q'</tt> - 64-bit signed integer, native-endian
(like C <tt>int64_t</tt>):
@@ -196,7 +196,7 @@ for one element in the input or output array.
s.unpack('Q*')
# => [578437695752307201, 17940646550795321087]
-==== Platform-Dependent \Integer Directives
+=== Platform-Dependent \Integer Directives
- <tt>'i'</tt> - Platform-dependent width signed integer,
native-endian (like C <tt>int</tt>):
@@ -230,7 +230,7 @@ for one element in the input or output array.
s.unpack('J*')
# => [67305985, 4244504319]
-==== Other \Integer Directives
+=== Other \Integer Directives
- <tt>'U'</tt> - UTF-8 character:
@@ -247,7 +247,7 @@ for one element in the input or output array.
s.unpack('w*')
# => [1073741823]
-==== Modifiers for \Integer Directives
+=== Modifiers for \Integer Directives
For the following directives, <tt>'!'</tt> or <tt>'_'</tt> modifiers may be
suffixed as underlying platform’s native size.
@@ -265,12 +265,12 @@ The endian modifiers also may be suffixed in the directives above:
- <tt>'>'</tt> - Big-endian.
- <tt>'<'</tt> - Little-endian.
-=== \Float Directives
+== \Float Directives
Each float directive specifies the packing or unpacking
for one element in the input or output array.
-==== Single-Precision \Float Directives
+=== Single-Precision \Float Directives
- <tt>'F'</tt> or <tt>'f'</tt> - Native format:
@@ -287,7 +287,7 @@ for one element in the input or output array.
s = [3.0].pack('g') # => "@@\x00\x00"
s.unpack('g') # => [3.0]
-==== Double-Precision \Float Directives
+=== Double-Precision \Float Directives
- <tt>'D'</tt> or <tt>'d'</tt> - Native format:
@@ -314,12 +314,12 @@ A float directive may be infinity or not-a-number:
[nan].pack('f') # => "\x00\x00\xC0\x7F"
"\x00\x00\xC0\x7F".unpack('f') # => [NaN]
-=== \String Directives
+== \String Directives
Each string directive specifies the packing or unpacking
for one byte in the input or output string.
-==== Binary \String Directives
+=== Binary \String Directives
- <tt>'A'</tt> - Arbitrary binary string (space padded; count is width);
+nil+ is treated as the empty string:
@@ -377,7 +377,7 @@ for one byte in the input or output string.
"foo".unpack('Z*') # => ["foo"]
"foo\0bar".unpack('Z*') # => ["foo"] # Does not read past "\0".
-==== Bit \String Directives
+=== Bit \String Directives
- <tt>'B'</tt> - Bit string (high byte first):
@@ -421,7 +421,7 @@ for one byte in the input or output string.
"\x01".unpack("b2") # => ["10"]
"\x01".unpack("b3") # => ["100"]
-==== Hex \String Directives
+=== Hex \String Directives
- <tt>'H'</tt> - Hex string (high nibble first):
@@ -467,7 +467,7 @@ for one byte in the input or output string.
"\x01\xfe".unpack('h4') # => ["10ef"]
"\x01\xfe".unpack('h5') # => ["10ef"]
-==== Pointer \String Directives
+=== Pointer \String Directives
- <tt>'P'</tt> - Pointer to a structure (fixed-length string):
@@ -485,7 +485,7 @@ for one byte in the input or output string.
("\0" * 8).unpack("p") # => [nil]
[nil].pack("p") # => "\x00\x00\x00\x00\x00\x00\x00\x00"
-==== Other \String Directives
+=== Other \String Directives
- <tt>'M'</tt> - Quoted printable, MIME encoding;
text mode, but input must use LF and output LF;
@@ -559,7 +559,7 @@ for one byte in the input or output string.
[0x40000000].pack("U") # => "\xFD\x80\x80\x80\x80\x80"
[0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
-=== Offset Directives
+== Offset Directives
- <tt>'@'</tt> - Begin packing at the given byte offset;
for packing, null fill if necessary:
@@ -577,7 +577,7 @@ for one byte in the input or output string.
[0, 1, 2].pack("CCX2C") # => "\x02"
"\x00\x02".unpack("CCXC") # => [0, 2, 2]
-=== Null Byte Direcive
+== Null Byte Direcive
- <tt>'x'</tt> - Null byte:
diff --git a/doc/strftime_formatting.rdoc b/doc/strftime_formatting.rdoc
index 30a629bf68..7694752a21 100644
--- a/doc/strftime_formatting.rdoc
+++ b/doc/strftime_formatting.rdoc
@@ -1,4 +1,4 @@
-== Formats for Dates and Times
+= Formats for Dates and Times
Several Ruby time-related classes have instance method +strftime+,
which returns a formatted string representing all or part of a date or time:
@@ -32,9 +32,9 @@ It consists of:
Except for the leading percent character,
the only required part is the conversion specifier, so we begin with that.
-=== Conversion Specifiers
+== Conversion Specifiers
-==== \Date (Year, Month, Day)
+=== \Date (Year, Month, Day)
- <tt>%Y</tt> - Year including century, zero-padded:
@@ -87,7 +87,7 @@ the only required part is the conversion specifier, so we begin with that.
Time.new(2002, 1, 1).strftime('%j') # => "001"
Time.new(2002, 12, 31).strftime('%j') # => "365"
-==== \Time (Hour, Minute, Second, Subsecond)
+=== \Time (Hour, Minute, Second, Subsecond)
- <tt>%H</tt> - Hour of the day, in range (0..23), zero-padded:
@@ -152,7 +152,7 @@ the only required part is the conversion specifier, so we begin with that.
Time.now.strftime('%s') # => "1656505136"
-==== Timezone
+=== Timezone
- <tt>%z</tt> - Timezone as hour and minute offset from UTC:
@@ -162,7 +162,7 @@ the only required part is the conversion specifier, so we begin with that.
Time.now.strftime('%Z') # => "Central Daylight Time"
-==== Weekday
+=== Weekday
- <tt>%A</tt> - Full weekday name:
@@ -184,7 +184,7 @@ the only required part is the conversion specifier, so we begin with that.
t.strftime('%a') # => "Sun"
t.strftime('%w') # => "0"
-==== Week Number
+=== Week Number
- <tt>%U</tt> - Week number of the year, in range (0..53), zero-padded,
where each week begins on a Sunday:
@@ -200,7 +200,7 @@ the only required part is the conversion specifier, so we begin with that.
t.strftime('%a') # => "Sun"
t.strftime('%W') # => "25"
-==== Week Dates
+=== Week Dates
See {ISO 8601 week dates}[https://en.wikipedia.org/wiki/ISO_8601#Week_dates].
@@ -223,7 +223,7 @@ See {ISO 8601 week dates}[https://en.wikipedia.org/wiki/ISO_8601#Week_dates].
t0.strftime('%V') # => "52"
t1.strftime('%V') # => "01"
-==== Literals
+=== Literals
- <tt>%n</tt> - Newline character "\n":
@@ -237,7 +237,7 @@ See {ISO 8601 week dates}[https://en.wikipedia.org/wiki/ISO_8601#Week_dates].
Time.now.strftime('%%') # => "%"
-==== Shorthand Conversion Specifiers
+=== Shorthand Conversion Specifiers
Each shorthand specifier here is shown with its corresponding
longhand specifier.
@@ -294,14 +294,14 @@ longhand specifier.
DateTime.now.strftime('%a %b %e %H:%M:%S %Z %Y')
# => "Wed Jun 29 08:32:18 -05:00 2022"
-=== Flags
+== Flags
Flags may affect certain formatting specifications.
Multiple flags may be given with a single conversion specified;
order does not matter.
-==== Padding Flags
+=== Padding Flags
- <tt>0</tt> - Pad with zeroes:
@@ -315,7 +315,7 @@ order does not matter.
Time.new(10).strftime('%-Y') # => "10"
-==== Casing Flags
+=== Casing Flags
- <tt>^</tt> - Upcase result:
@@ -328,7 +328,7 @@ order does not matter.
Time.now.strftime('%^p') # => "AM"
Time.now.strftime('%#p') # => "am"
-==== Timezone Flags
+=== Timezone Flags
- <tt>:</tt> - Put timezone as colon-separated hours and minutes:
@@ -338,7 +338,7 @@ order does not matter.
Time.now.strftime('%::z') # => "-05:00:00"
-=== Width Specifiers
+== Width Specifiers
The integer width specifier gives a minimum width for the returned string:
@@ -348,12 +348,12 @@ The integer width specifier gives a minimum width for the returned string:
Time.new(2002, 12).strftime('%10B') # => " December"
Time.new(2002, 12).strftime('%3B') # => "December" # Ignored if too small.
-== Specialized Format Strings
+= Specialized Format Strings
Here are a few specialized format strings,
each based on an external standard.
-=== HTTP Format
+== HTTP Format
The HTTP date format is based on
{RFC 2616}[https://datatracker.ietf.org/doc/html/rfc2616],
@@ -368,7 +368,7 @@ and treats dates in the format <tt>'%a, %d %b %Y %T GMT'</tt>:
Date._httpdate(httpdate)
# => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"GMT", :offset=>0}
-=== RFC 3339 Format
+== RFC 3339 Format
The RFC 3339 date format is based on
{RFC 3339}[https://datatracker.ietf.org/doc/html/rfc3339]:
@@ -382,7 +382,7 @@ The RFC 3339 date format is based on
Date._rfc3339(rfc3339)
# => {:year=>2001, :mon=>2, :mday=>3, :hour=>0, :min=>0, :sec=>0, :zone=>"+00:00", :offset=>0}
-=== RFC 2822 Format
+== RFC 2822 Format
The RFC 2822 date format is based on
{RFC 2822}[https://datatracker.ietf.org/doc/html/rfc2822],
@@ -397,7 +397,7 @@ and treats dates in the format <tt>'%a, %-d %b %Y %T %z'</tt>]:
Date._rfc2822(rfc2822)
# => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"+0000", :offset=>0}
-=== JIS X 0301 Format
+== JIS X 0301 Format
The JIS X 0301 format includes the
{Japanese era name}[https://en.wikipedia.org/wiki/Japanese_era_name],
@@ -412,7 +412,7 @@ with the first letter of the romanized era name prefixed:
# Return hash parsed from 0301-formatted string.
Date._jisx0301(jisx0301) # => {:year=>2001, :mon=>2, :mday=>3}
-=== ISO 8601 Format Specifications
+== ISO 8601 Format Specifications
This section shows format specifications that are compatible with
{ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601].
@@ -422,7 +422,7 @@ Examples in this section assume:
t = Time.now # => 2022-06-29 16:49:25.465246 -0500
-==== Dates
+=== Dates
See {ISO 8601 dates}[https://en.wikipedia.org/wiki/ISO_8601#Dates].
@@ -473,7 +473,7 @@ See {ISO 8601 dates}[https://en.wikipedia.org/wiki/ISO_8601#Dates].
t.strftime('%Y-%j') # => "2022-180"
-==== Times
+=== Times
See {ISO 8601 times}[https://en.wikipedia.org/wiki/ISO_8601#Times].
@@ -514,7 +514,7 @@ See {ISO 8601 times}[https://en.wikipedia.org/wiki/ISO_8601#Times].
- {Coordinated Universal Time (UTC)}[https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)].
- {Time offsets from UTC}[https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC].
-==== Combined \Date and \Time
+=== Combined \Date and \Time
See {ISO 8601 Combined date and time representations}[https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations].
diff --git a/doc/timezones.rdoc b/doc/timezones.rdoc
index 18233b97ae..5b3a224d14 100644
--- a/doc/timezones.rdoc
+++ b/doc/timezones.rdoc
@@ -1,6 +1,6 @@
-== Timezones
+= Timezones
-=== Timezone Specifiers
+== Timezone Specifiers
Certain \Time methods accept arguments that specify timezones:
@@ -18,7 +18,7 @@ The value given with any of these must be one of the following
- {Integer offset}[rdoc-ref:timezones.rdoc@Integer+Offsets].
- {Timezone object}[rdoc-ref:timezones.rdoc@Timezone+Objects].
-==== Hours/Minutes Offsets
+=== Hours/Minutes Offsets
The zone value may be a string offset from UTC
in the form <tt>'+HH:MM'</tt> or <tt>'-HH:MM'</tt>,
@@ -33,7 +33,7 @@ Examples:
Time.at(t, in: '-23:59') # => 1999-12-31 20:16:01 -2359
Time.at(t, in: '+23:59') # => 2000-01-02 20:14:01 +2359
-==== Single-Letter Offsets
+=== Single-Letter Offsets
The zone value may be a letter in the range <tt>'A'..'I'</tt>
or <tt>'K'..'Z'</tt>;
@@ -46,7 +46,7 @@ see {List of military time zones}[https://en.wikipedia.org/wiki/List_of_military
Time.at(t, in: 'Y') # => 2000-01-01 08:15:01 -1200
Time.at(t, in: 'Z') # => 2000-01-01 20:15:01 UTC
-==== \Integer Offsets
+=== \Integer Offsets
The zone value may be an integer number of seconds
in the range <tt>-86399..86399</tt>:
@@ -55,7 +55,7 @@ in the range <tt>-86399..86399</tt>:
Time.at(t, in: -86399) # => 1999-12-31 20:15:02 -235959
Time.at(t, in: 86399) # => 2000-01-02 20:15:00 +235959
-==== Timezone Objects
+=== Timezone Objects
The zone value may be an object responding to certain timezone methods.