rbs 3.0.0.dev.2 → 3.0.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
data/core/dir.rbs
CHANGED
@@ -11,135 +11,83 @@
|
|
11
11
|
#
|
12
12
|
# First, what's elsewhere. Class Dir:
|
13
13
|
#
|
14
|
-
# * Inherits from [class
|
15
|
-
#
|
16
|
-
# * Includes [module
|
17
|
-
# Enumerable](Enumerable.html#module-Enumerable-label-What-27s+Here), which
|
14
|
+
# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
|
15
|
+
# * Includes [module Enumerable](rdoc-ref:Enumerable@What-27s+Here), which
|
18
16
|
# provides dozens of additional methods.
|
19
17
|
#
|
20
18
|
#
|
21
19
|
# Here, class Dir provides methods that are useful for:
|
22
20
|
#
|
23
|
-
# * [Reading](
|
24
|
-
# * [Setting](
|
25
|
-
# * [Querying](
|
26
|
-
# * [Iterating](
|
27
|
-
# * [Other](
|
21
|
+
# * [Reading](rdoc-ref:Dir@Reading)
|
22
|
+
# * [Setting](rdoc-ref:Dir@Setting)
|
23
|
+
# * [Querying](rdoc-ref:Dir@Querying)
|
24
|
+
# * [Iterating](rdoc-ref:Dir@Iterating)
|
25
|
+
# * [Other](rdoc-ref:Dir@Other)
|
28
26
|
#
|
29
27
|
#
|
30
28
|
# ### Reading
|
31
29
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# :
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# #rewind
|
42
|
-
# : Sets the position in the directory stream for `self` to the first
|
43
|
-
# entry.
|
44
|
-
#
|
45
|
-
# #seek
|
46
|
-
# : Sets the position in the directory stream for `self` the entry at the
|
47
|
-
# given offset.
|
48
|
-
#
|
30
|
+
# * #close: Closes the directory stream for `self`.
|
31
|
+
# * #pos=: Sets the position in the directory stream for `self`.
|
32
|
+
# * #read: Reads and returns the next entry in the directory stream for
|
33
|
+
# `self`.
|
34
|
+
# * #rewind: Sets the position in the directory stream for `self` to the first
|
35
|
+
# entry.
|
36
|
+
# * #seek: Sets the position in the directory stream for `self` the entry at
|
37
|
+
# the given offset.
|
49
38
|
#
|
50
39
|
#
|
51
40
|
# ### Setting
|
52
41
|
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# ::chroot
|
58
|
-
# : Changes the file-system root for the current process to the given
|
59
|
-
# directory.
|
60
|
-
#
|
42
|
+
# * ::chdir: Changes the working directory of the current process to the given
|
43
|
+
# directory.
|
44
|
+
# * ::chroot: Changes the file-system root for the current process to the
|
45
|
+
# given directory.
|
61
46
|
#
|
62
47
|
#
|
63
48
|
# ### Querying
|
64
49
|
#
|
65
|
-
#
|
66
|
-
# :
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# :
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# :
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# :
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# ::glob
|
86
|
-
# : Returns an array of file paths matching the given pattern and flags.
|
87
|
-
#
|
88
|
-
# ::home
|
89
|
-
# : Returns the home directory path for a given user or the current user.
|
90
|
-
#
|
91
|
-
# #children
|
92
|
-
# : Returns an array of names of the children (both files and directories)
|
93
|
-
# of `self`, but not including `.` or `..`.
|
94
|
-
#
|
95
|
-
# #fileno
|
96
|
-
# : Returns the integer file descriptor for `self`.
|
97
|
-
#
|
98
|
-
# #path (aliased as #to_path)
|
99
|
-
# : Returns the path used to create `self`.
|
100
|
-
#
|
101
|
-
# #tell (aliased as #pos)
|
102
|
-
# : Returns the integer position in the directory stream for `self`.
|
103
|
-
#
|
50
|
+
# * ::[]: Same as ::glob without the ability to pass flags.
|
51
|
+
# * ::children: Returns an array of names of the children (both files and
|
52
|
+
# directories) of the given directory, but not including `.` or `..`.
|
53
|
+
# * ::empty?: Returns whether the given path is an empty directory.
|
54
|
+
# * ::entries: Returns an array of names of the children (both files and
|
55
|
+
# directories) of the given directory, including `.` and `..`.
|
56
|
+
# * ::exist?: Returns whether the given path is a directory.
|
57
|
+
# * ::getwd (aliased as #pwd): Returns the path to the current working
|
58
|
+
# directory.
|
59
|
+
# * ::glob: Returns an array of file paths matching the given pattern and
|
60
|
+
# flags.
|
61
|
+
# * ::home: Returns the home directory path for a given user or the current
|
62
|
+
# user.
|
63
|
+
# * #children: Returns an array of names of the children (both files and
|
64
|
+
# directories) of `self`, but not including `.` or `..`.
|
65
|
+
# * #fileno: Returns the integer file descriptor for `self`.
|
66
|
+
# * #path (aliased as #to_path): Returns the path used to create `self`.
|
67
|
+
# * #tell (aliased as #pos): Returns the integer position in the directory
|
68
|
+
# stream for `self`.
|
104
69
|
#
|
105
70
|
#
|
106
71
|
# ### Iterating
|
107
72
|
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
# #each
|
117
|
-
# : Calls the given block with each entry in `self`, including `.` and
|
118
|
-
# `..`.
|
119
|
-
#
|
120
|
-
# #each_child
|
121
|
-
# : Calls the given block with each entry in `self`, but not including `.`
|
122
|
-
# or `..`.
|
123
|
-
#
|
73
|
+
# * ::each_child: Calls the given block with each entry in the given
|
74
|
+
# directory, but not including `.` or `..`.
|
75
|
+
# * ::foreach: Calls the given block with each entry in the given directory,
|
76
|
+
# including `.` and `..`.
|
77
|
+
# * #each: Calls the given block with each entry in `self`, including `.` and
|
78
|
+
# `..`.
|
79
|
+
# * #each_child: Calls the given block with each entry in `self`, but not
|
80
|
+
# including `.` or `..`.
|
124
81
|
#
|
125
82
|
#
|
126
83
|
# ### Other
|
127
84
|
#
|
128
|
-
#
|
129
|
-
# :
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
# ::open
|
135
|
-
# : Same as ::new, but if a block is given, yields the Dir to the block,
|
136
|
-
# closing it upon block exit.
|
137
|
-
#
|
138
|
-
# ::unlink (aliased as ::delete and ::rmdir)
|
139
|
-
# : Removes the given directory.
|
140
|
-
#
|
141
|
-
# #inspect
|
142
|
-
# : Returns a string description of `self`.
|
85
|
+
# * ::mkdir: Creates a directory at the given path, with optional permissions.
|
86
|
+
# * ::new: Returns a new Dir for the given path, with optional encoding.
|
87
|
+
# * ::open: Same as ::new, but if a block is given, yields the Dir to the
|
88
|
+
# block, closing it upon block exit.
|
89
|
+
# * ::unlink (aliased as ::delete and ::rmdir): Removes the given directory.
|
90
|
+
# * #inspect: Returns a string description of `self`.
|
143
91
|
#
|
144
92
|
class Dir
|
145
93
|
include Enumerable[String]
|
data/core/encoding.rbs
CHANGED
@@ -1,195 +1,31 @@
|
|
1
1
|
# <!-- rdoc-file=encoding.c -->
|
2
2
|
# An Encoding instance represents a character encoding usable in Ruby. It is
|
3
|
-
# defined as a constant under the Encoding namespace. It has a name and
|
3
|
+
# defined as a constant under the Encoding namespace. It has a name and,
|
4
4
|
# optionally, aliases:
|
5
5
|
#
|
6
|
-
# Encoding::
|
7
|
-
#
|
6
|
+
# Encoding::US_ASCII.name # => "US-ASCII"
|
7
|
+
# Encoding::US_ASCII.names # => ["US-ASCII", "ASCII", "ANSI_X3.4-1968", "646"]
|
8
8
|
#
|
9
|
-
#
|
10
|
-
# #=> ["ISO-8859-1", "ISO8859-1"]
|
9
|
+
# A Ruby method that accepts an encoding as an argument will accept:
|
11
10
|
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
11
|
+
# * An Encoding object.
|
12
|
+
# * The name of an encoding.
|
13
|
+
# * An alias for an encoding name.
|
15
14
|
#
|
16
|
-
# "some string".encoding
|
17
|
-
# #=> #<Encoding:UTF-8>
|
18
15
|
#
|
19
|
-
#
|
20
|
-
# #=> "some string"
|
21
|
-
# string.encoding
|
22
|
-
# #=> #<Encoding:ISO-8859-1>
|
16
|
+
# These are equivalent:
|
23
17
|
#
|
24
|
-
#
|
25
|
-
#
|
18
|
+
# 'foo'.encode(Encoding::US_ASCII) # Encoding object.
|
19
|
+
# 'foo'.encode('US-ASCII') # Encoding name.
|
20
|
+
# 'foo'.encode('ASCII') # Encoding alias.
|
26
21
|
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# range of ASCII are considered as ASCII characters. This is useful when you
|
30
|
-
# use ASCII-8BIT characters with other ASCII compatible characters.
|
22
|
+
# For a full discussion of encodings and their uses, see [the Encodings
|
23
|
+
# document](rdoc-ref:encodings.rdoc).
|
31
24
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# First, it is possible to set the Encoding of a string to a new Encoding
|
37
|
-
# without changing the internal byte representation of the string, with
|
38
|
-
# String#force_encoding. This is how you can tell Ruby the correct encoding of a
|
39
|
-
# string.
|
40
|
-
#
|
41
|
-
# string
|
42
|
-
# #=> "R\xC3\xA9sum\xC3\xA9"
|
43
|
-
# string.encoding
|
44
|
-
# #=> #<Encoding:ISO-8859-1>
|
45
|
-
# string.force_encoding(Encoding::UTF_8)
|
46
|
-
# #=> "R\u00E9sum\u00E9"
|
47
|
-
#
|
48
|
-
# Second, it is possible to transcode a string, i.e. translate its internal byte
|
49
|
-
# representation to another encoding. Its associated encoding is also set to the
|
50
|
-
# other encoding. See String#encode for the various forms of transcoding, and
|
51
|
-
# the Encoding::Converter class for additional control over the transcoding
|
52
|
-
# process.
|
53
|
-
#
|
54
|
-
# string
|
55
|
-
# #=> "R\u00E9sum\u00E9"
|
56
|
-
# string.encoding
|
57
|
-
# #=> #<Encoding:UTF-8>
|
58
|
-
# string = string.encode!(Encoding::ISO_8859_1)
|
59
|
-
# #=> "R\xE9sum\xE9"
|
60
|
-
# string.encoding
|
61
|
-
# #=> #<Encoding::ISO-8859-1>
|
62
|
-
#
|
63
|
-
# ## Script encoding
|
64
|
-
#
|
65
|
-
# All Ruby script code has an associated Encoding which any String literal
|
66
|
-
# created in the source code will be associated to.
|
67
|
-
#
|
68
|
-
# The default script encoding is Encoding::UTF_8 after v2.0, but it can be
|
69
|
-
# changed by a magic comment on the first line of the source code file (or
|
70
|
-
# second line, if there is a shebang line on the first). The comment must
|
71
|
-
# contain the word `coding` or `encoding`, followed by a colon, space and the
|
72
|
-
# Encoding name or alias:
|
73
|
-
#
|
74
|
-
# # encoding: UTF-8
|
75
|
-
#
|
76
|
-
# "some string".encoding
|
77
|
-
# #=> #<Encoding:UTF-8>
|
78
|
-
#
|
79
|
-
# The `__ENCODING__` keyword returns the script encoding of the file which the
|
80
|
-
# keyword is written:
|
81
|
-
#
|
82
|
-
# # encoding: ISO-8859-1
|
83
|
-
#
|
84
|
-
# __ENCODING__
|
85
|
-
# #=> #<Encoding:ISO-8859-1>
|
86
|
-
#
|
87
|
-
# `ruby -K` will change the default locale encoding, but this is not
|
88
|
-
# recommended. Ruby source files should declare its script encoding by a magic
|
89
|
-
# comment even when they only depend on US-ASCII strings or regular expressions.
|
90
|
-
#
|
91
|
-
# ## Locale encoding
|
92
|
-
#
|
93
|
-
# The default encoding of the environment. Usually derived from locale.
|
94
|
-
#
|
95
|
-
# see Encoding.locale_charmap, Encoding.find('locale')
|
96
|
-
#
|
97
|
-
# ## Filesystem encoding
|
98
|
-
#
|
99
|
-
# The default encoding of strings from the filesystem of the environment. This
|
100
|
-
# is used for strings of file names or paths.
|
101
|
-
#
|
102
|
-
# see Encoding.find('filesystem')
|
103
|
-
#
|
104
|
-
# ## External encoding
|
105
|
-
#
|
106
|
-
# Each IO object has an external encoding which indicates the encoding that Ruby
|
107
|
-
# will use to read its data. By default Ruby sets the external encoding of an IO
|
108
|
-
# object to the default external encoding. The default external encoding is set
|
109
|
-
# by locale encoding or the interpreter `-E` option. Encoding.default_external
|
110
|
-
# returns the current value of the external encoding.
|
111
|
-
#
|
112
|
-
# ENV["LANG"]
|
113
|
-
# #=> "UTF-8"
|
114
|
-
# Encoding.default_external
|
115
|
-
# #=> #<Encoding:UTF-8>
|
116
|
-
#
|
117
|
-
# $ ruby -E ISO-8859-1 -e "p Encoding.default_external"
|
118
|
-
# #<Encoding:ISO-8859-1>
|
119
|
-
#
|
120
|
-
# $ LANG=C ruby -e 'p Encoding.default_external'
|
121
|
-
# #<Encoding:US-ASCII>
|
122
|
-
#
|
123
|
-
# The default external encoding may also be set through
|
124
|
-
# Encoding.default_external=, but you should not do this as strings created
|
125
|
-
# before and after the change will have inconsistent encodings. Instead use
|
126
|
-
# `ruby -E` to invoke ruby with the correct external encoding.
|
127
|
-
#
|
128
|
-
# When you know that the actual encoding of the data of an IO object is not the
|
129
|
-
# default external encoding, you can reset its external encoding with
|
130
|
-
# IO#set_encoding or set it at IO object creation (see IO.new options).
|
131
|
-
#
|
132
|
-
# ## Internal encoding
|
133
|
-
#
|
134
|
-
# To process the data of an IO object which has an encoding different from its
|
135
|
-
# external encoding, you can set its internal encoding. Ruby will use this
|
136
|
-
# internal encoding to transcode the data when it is read from the IO object.
|
137
|
-
#
|
138
|
-
# Conversely, when data is written to the IO object it is transcoded from the
|
139
|
-
# internal encoding to the external encoding of the IO object.
|
140
|
-
#
|
141
|
-
# The internal encoding of an IO object can be set with IO#set_encoding or at IO
|
142
|
-
# object creation (see IO.new options).
|
143
|
-
#
|
144
|
-
# The internal encoding is optional and when not set, the Ruby default internal
|
145
|
-
# encoding is used. If not explicitly set this default internal encoding is
|
146
|
-
# `nil` meaning that by default, no transcoding occurs.
|
147
|
-
#
|
148
|
-
# The default internal encoding can be set with the interpreter option `-E`.
|
149
|
-
# Encoding.default_internal returns the current internal encoding.
|
150
|
-
#
|
151
|
-
# $ ruby -e 'p Encoding.default_internal'
|
152
|
-
# nil
|
153
|
-
#
|
154
|
-
# $ ruby -E ISO-8859-1:UTF-8 -e "p [Encoding.default_external, \
|
155
|
-
# Encoding.default_internal]"
|
156
|
-
# [#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>]
|
157
|
-
#
|
158
|
-
# The default internal encoding may also be set through
|
159
|
-
# Encoding.default_internal=, but you should not do this as strings created
|
160
|
-
# before and after the change will have inconsistent encodings. Instead use
|
161
|
-
# `ruby -E` to invoke ruby with the correct internal encoding.
|
162
|
-
#
|
163
|
-
# ## IO encoding example
|
164
|
-
#
|
165
|
-
# In the following example a UTF-8 encoded string "Ru00E9sumu00E9" is transcoded
|
166
|
-
# for output to ISO-8859-1 encoding, then read back in and transcoded to UTF-8:
|
167
|
-
#
|
168
|
-
# string = "R\u00E9sum\u00E9"
|
169
|
-
#
|
170
|
-
# open("transcoded.txt", "w:ISO-8859-1") do |io|
|
171
|
-
# io.write(string)
|
172
|
-
# end
|
173
|
-
#
|
174
|
-
# puts "raw text:"
|
175
|
-
# p File.binread("transcoded.txt")
|
176
|
-
# puts
|
177
|
-
#
|
178
|
-
# open("transcoded.txt", "r:ISO-8859-1:UTF-8") do |io|
|
179
|
-
# puts "transcoded text:"
|
180
|
-
# p io.read
|
181
|
-
# end
|
182
|
-
#
|
183
|
-
# While writing the file, the internal encoding is not specified as it is only
|
184
|
-
# necessary for reading. While reading the file both the internal and external
|
185
|
-
# encoding must be specified to obtain the correct result.
|
186
|
-
#
|
187
|
-
# $ ruby t.rb
|
188
|
-
# raw text:
|
189
|
-
# "R\xE9sum\xE9"
|
190
|
-
#
|
191
|
-
# transcoded text:
|
192
|
-
# "R\u00E9sum\u00E9"
|
25
|
+
# Encoding::ASCII_8BIT is a special-purpose encoding that is usually used for a
|
26
|
+
# string of bytes, not a string of characters. But as the name indicates, its
|
27
|
+
# characters in the ASCII range are considered as ASCII characters. This is
|
28
|
+
# useful when you use other ASCII-compatible encodings.
|
193
29
|
#
|
194
30
|
class Encoding < Object
|
195
31
|
# <!--
|
@@ -1352,11 +1188,13 @@ class Encoding::Converter < Object
|
|
1352
1188
|
# :undef => :replace # replace undefined conversion
|
1353
1189
|
# :replace => string # replacement string ("?" or "\uFFFD" if not specified)
|
1354
1190
|
# :newline => :universal # decorator for converting CRLF and CR to LF
|
1191
|
+
# :newline => :lf # decorator for converting CRLF and CR to LF when writing
|
1355
1192
|
# :newline => :crlf # decorator for converting LF to CRLF
|
1356
1193
|
# :newline => :cr # decorator for converting LF to CR
|
1357
1194
|
# :universal_newline => true # decorator for converting CRLF and CR to LF
|
1358
1195
|
# :crlf_newline => true # decorator for converting LF to CRLF
|
1359
1196
|
# :cr_newline => true # decorator for converting LF to CR
|
1197
|
+
# :lf_newline => true # decorator for converting CRLF and CR to LF when writing
|
1360
1198
|
# :xml => :text # escape as XML CharData.
|
1361
1199
|
# :xml => :attr # escape as XML AttValue
|
1362
1200
|
# integer form:
|
@@ -1364,6 +1202,7 @@ class Encoding::Converter < Object
|
|
1364
1202
|
# Encoding::Converter::UNDEF_REPLACE
|
1365
1203
|
# Encoding::Converter::UNDEF_HEX_CHARREF
|
1366
1204
|
# Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR
|
1205
|
+
# Encoding::Converter::LF_NEWLINE_DECORATOR
|
1367
1206
|
# Encoding::Converter::CRLF_NEWLINE_DECORATOR
|
1368
1207
|
# Encoding::Converter::CR_NEWLINE_DECORATOR
|
1369
1208
|
# Encoding::Converter::XML_TEXT_DECORATOR
|
@@ -1406,6 +1245,8 @@ class Encoding::Converter < Object
|
|
1406
1245
|
# : Convert LF to CRLF.
|
1407
1246
|
# :cr_newline => true
|
1408
1247
|
# : Convert LF to CR.
|
1248
|
+
# :lf_newline => true
|
1249
|
+
# : Convert CRLF and CR to LF (when writing).
|
1409
1250
|
# :xml => :text
|
1410
1251
|
# : Escape as XML CharData. This form can be used as an HTML 4.0 #PCDATA.
|
1411
1252
|
# * '&' -> '&'
|