rbs 0.12.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +8 -4
  3. data/.gitignore +0 -1
  4. data/CHANGELOG.md +32 -0
  5. data/Gemfile +4 -0
  6. data/README.md +8 -2
  7. data/Rakefile +9 -2
  8. data/Steepfile +1 -1
  9. data/bin/annotate-with-rdoc +1 -1
  10. data/bin/setup +0 -2
  11. data/bin/test_runner.rb +15 -1
  12. data/{stdlib/builtin → core}/array.rbs +124 -120
  13. data/{stdlib/builtin → core}/basic_object.rbs +54 -54
  14. data/{stdlib/builtin → core}/binding.rbs +42 -42
  15. data/core/builtin.rbs +70 -0
  16. data/{stdlib/builtin → core}/class.rbs +33 -33
  17. data/{stdlib/builtin → core}/comparable.rbs +0 -0
  18. data/{stdlib/builtin → core}/complex.rbs +90 -90
  19. data/{stdlib/builtin → core}/constants.rbs +0 -0
  20. data/{stdlib/builtin → core}/data.rbs +0 -0
  21. data/{stdlib/builtin → core}/deprecated.rbs +0 -0
  22. data/{stdlib/builtin → core}/dir.rbs +0 -0
  23. data/{stdlib/builtin → core}/encoding.rbs +33 -33
  24. data/{stdlib/builtin → core}/enumerable.rbs +58 -52
  25. data/{stdlib/builtin → core}/enumerator.rbs +35 -35
  26. data/{stdlib/builtin → core}/errno.rbs +0 -0
  27. data/{stdlib/builtin → core}/errors.rbs +2 -2
  28. data/{stdlib/builtin → core}/exception.rbs +50 -50
  29. data/{stdlib/builtin → core}/false_class.rbs +6 -6
  30. data/{stdlib/builtin → core}/fiber.rbs +14 -14
  31. data/{stdlib/builtin → core}/fiber_error.rbs +1 -1
  32. data/{stdlib/builtin → core}/file.rbs +0 -0
  33. data/{stdlib/builtin → core}/file_test.rbs +0 -0
  34. data/{stdlib/builtin → core}/float.rbs +161 -161
  35. data/{stdlib/builtin → core}/gc.rbs +3 -3
  36. data/{stdlib/builtin → core}/hash.rbs +7 -7
  37. data/{stdlib/builtin → core}/integer.rbs +0 -0
  38. data/{stdlib/builtin → core}/io.rbs +88 -88
  39. data/{stdlib/builtin → core}/kernel.rbs +71 -153
  40. data/{stdlib/builtin → core}/marshal.rbs +0 -0
  41. data/{stdlib/builtin → core}/match_data.rbs +1 -1
  42. data/{stdlib/builtin → core}/math.rbs +0 -0
  43. data/{stdlib/builtin → core}/method.rbs +19 -19
  44. data/{stdlib/builtin → core}/module.rbs +13 -13
  45. data/{stdlib/builtin → core}/nil_class.rbs +20 -20
  46. data/{stdlib/builtin → core}/numeric.rbs +101 -101
  47. data/{stdlib/builtin → core}/object.rbs +173 -173
  48. data/{stdlib/builtin → core}/proc.rbs +91 -91
  49. data/{stdlib/builtin → core}/process.rbs +0 -0
  50. data/{stdlib/builtin → core}/random.rbs +1 -1
  51. data/{stdlib/builtin → core}/range.rbs +3 -5
  52. data/{stdlib/builtin → core}/rational.rbs +83 -83
  53. data/{stdlib/builtin → core}/rb_config.rbs +0 -0
  54. data/{stdlib/builtin → core}/regexp.rbs +0 -0
  55. data/{stdlib/builtin → core}/ruby_vm.rbs +0 -0
  56. data/{stdlib/builtin → core}/signal.rbs +7 -7
  57. data/{stdlib/builtin → core}/string.rbs +10 -10
  58. data/{stdlib/builtin → core}/string_io.rbs +8 -8
  59. data/{stdlib/builtin → core}/struct.rbs +1 -1
  60. data/{stdlib/builtin → core}/symbol.rbs +1 -1
  61. data/{stdlib/builtin → core}/thread.rbs +189 -189
  62. data/{stdlib/builtin → core}/thread_group.rbs +2 -2
  63. data/{stdlib/builtin → core}/time.rbs +0 -0
  64. data/{stdlib/builtin → core}/trace_point.rbs +0 -0
  65. data/{stdlib/builtin → core}/true_class.rbs +10 -10
  66. data/{stdlib/builtin → core}/unbound_method.rbs +0 -0
  67. data/{stdlib/builtin → core}/warning.rbs +1 -1
  68. data/docs/CONTRIBUTING.md +1 -0
  69. data/docs/repo.md +125 -0
  70. data/docs/syntax.md +50 -6
  71. data/goodcheck.yml +22 -5
  72. data/lib/rbs.rb +1 -0
  73. data/lib/rbs/ast/comment.rb +1 -1
  74. data/lib/rbs/cli.rb +117 -107
  75. data/lib/rbs/constant.rb +1 -1
  76. data/lib/rbs/constant_table.rb +9 -8
  77. data/lib/rbs/definition_builder.rb +6 -7
  78. data/lib/rbs/environment.rb +5 -1
  79. data/lib/rbs/environment_loader.rb +79 -105
  80. data/lib/rbs/namespace.rb +1 -1
  81. data/lib/rbs/parser.rb +3148 -0
  82. data/lib/rbs/parser.y +10 -3
  83. data/lib/rbs/prototype/rb.rb +38 -6
  84. data/lib/rbs/prototype/runtime.rb +17 -7
  85. data/lib/rbs/repository.rb +121 -0
  86. data/lib/rbs/test/hook.rb +2 -0
  87. data/lib/rbs/test/setup.rb +5 -3
  88. data/lib/rbs/test/setup_helper.rb +4 -4
  89. data/lib/rbs/test/tester.rb +4 -1
  90. data/lib/rbs/test/type_check.rb +12 -6
  91. data/lib/rbs/type_name.rb +3 -2
  92. data/lib/rbs/variance_calculator.rb +2 -2
  93. data/lib/rbs/vendorer.rb +38 -16
  94. data/lib/rbs/version.rb +1 -1
  95. data/lib/rbs/writer.rb +25 -15
  96. data/sig/cli.rbs +58 -0
  97. data/sig/constant.rbs +21 -0
  98. data/sig/constant_table.rbs +30 -0
  99. data/sig/declarations.rbs +2 -2
  100. data/sig/definition.rbs +2 -2
  101. data/sig/definition_builder.rbs +6 -5
  102. data/sig/environment_loader.rbs +100 -0
  103. data/sig/members.rbs +2 -2
  104. data/sig/method_types.rbs +1 -1
  105. data/sig/namespace.rbs +4 -4
  106. data/sig/parser.rbs +25 -0
  107. data/sig/polyfill.rbs +42 -0
  108. data/sig/rbs.rbs +8 -0
  109. data/sig/repository.rbs +79 -0
  110. data/sig/substitution.rbs +3 -3
  111. data/sig/typename.rbs +1 -1
  112. data/sig/types.rbs +1 -1
  113. data/sig/vendorer.rbs +44 -0
  114. data/sig/version.rbs +3 -0
  115. data/sig/writer.rbs +40 -0
  116. data/stdlib/abbrev/{abbrev.rbs → 0/abbrev.rbs} +0 -0
  117. data/stdlib/base64/{base64.rbs → 0/base64.rbs} +1 -1
  118. data/stdlib/benchmark/{benchmark.rbs → 0/benchmark.rbs} +2 -2
  119. data/stdlib/{bigdecimal/math → bigdecimal-math/0}/big_math.rbs +0 -0
  120. data/stdlib/bigdecimal/{big_decimal.rbs → 0/big_decimal.rbs} +0 -0
  121. data/stdlib/coverage/{coverage.rbs → 0/coverage.rbs} +2 -2
  122. data/stdlib/csv/{csv.rbs → 0/csv.rbs} +1 -1
  123. data/stdlib/date/{date.rbs → 0/date.rbs} +4 -4
  124. data/stdlib/date/{date_time.rbs → 0/date_time.rbs} +1 -1
  125. data/stdlib/dbm/0/dbm.rbs +277 -0
  126. data/stdlib/erb/{erb.rbs → 0/erb.rbs} +0 -0
  127. data/stdlib/fiber/{fiber.rbs → 0/fiber.rbs} +0 -0
  128. data/stdlib/find/{find.rbs → 0/find.rbs} +12 -12
  129. data/stdlib/forwardable/{forwardable.rbs → 0/forwardable.rbs} +0 -0
  130. data/stdlib/ipaddr/{ipaddr.rbs → 0/ipaddr.rbs} +0 -0
  131. data/stdlib/json/{json.rbs → 0/json.rbs} +0 -0
  132. data/stdlib/logger/{formatter.rbs → 0/formatter.rbs} +0 -0
  133. data/stdlib/logger/{log_device.rbs → 0/log_device.rbs} +1 -1
  134. data/stdlib/logger/{logger.rbs → 0/logger.rbs} +1 -1
  135. data/stdlib/logger/{period.rbs → 0/period.rbs} +0 -0
  136. data/stdlib/logger/{severity.rbs → 0/severity.rbs} +0 -0
  137. data/stdlib/mutex_m/{mutex_m.rbs → 0/mutex_m.rbs} +0 -0
  138. data/stdlib/pathname/{pathname.rbs → 0/pathname.rbs} +41 -39
  139. data/stdlib/prime/{integer-extension.rbs → 0/integer-extension.rbs} +0 -0
  140. data/stdlib/prime/{prime.rbs → 0/prime.rbs} +0 -0
  141. data/stdlib/pstore/0/pstore.rbs +287 -0
  142. data/stdlib/pty/{pty.rbs → 0/pty.rbs} +1 -1
  143. data/stdlib/securerandom/{securerandom.rbs → 0/securerandom.rbs} +0 -0
  144. data/stdlib/set/{set.rbs → 0/set.rbs} +0 -0
  145. data/stdlib/tmpdir/{tmpdir.rbs → 0/tmpdir.rbs} +12 -12
  146. data/stdlib/uri/{file.rbs → 0/file.rbs} +0 -0
  147. data/stdlib/uri/{generic.rbs → 0/generic.rbs} +2 -2
  148. data/stdlib/uri/0/http.rbs +158 -0
  149. data/stdlib/uri/0/https.rbs +108 -0
  150. data/stdlib/uri/0/ldap.rbs +224 -0
  151. data/stdlib/uri/0/ldaps.rbs +108 -0
  152. data/stdlib/zlib/{zlib.rbs → 0/zlib.rbs} +0 -0
  153. data/steep/Gemfile.lock +13 -17
  154. metadata +105 -89
  155. data/stdlib/builtin/builtin.rbs +0 -42
File without changes
@@ -0,0 +1,287 @@
1
+ # PStore implements a file based persistence mechanism based on a Hash. User
2
+ # code can store hierarchies of Ruby objects (values) into the data store file
3
+ # by name (keys). An object hierarchy may be just a single object. User code
4
+ # may later read values back from the data store or even update data, as needed.
5
+ #
6
+ # The transactional behavior ensures that any changes succeed or fail together.
7
+ # This can be used to ensure that the data store is not left in a transitory
8
+ # state, where some values were updated but others were not.
9
+ #
10
+ # Behind the scenes, Ruby objects are stored to the data store file with
11
+ # Marshal. That carries the usual limitations. Proc objects cannot be
12
+ # marshalled, for example.
13
+ #
14
+ # ## Usage example:
15
+ #
16
+ # require "pstore"
17
+ #
18
+ # # a mock wiki object...
19
+ # class WikiPage
20
+ # def initialize( page_name, author, contents )
21
+ # @page_name = page_name
22
+ # @revisions = Array.new
23
+ #
24
+ # add_revision(author, contents)
25
+ # end
26
+ #
27
+ # attr_reader :page_name
28
+ #
29
+ # def add_revision( author, contents )
30
+ # @revisions << { :created => Time.now,
31
+ # :author => author,
32
+ # :contents => contents }
33
+ # end
34
+ #
35
+ # def wiki_page_references
36
+ # [@page_name] + @revisions.last[:contents].scan(/\b(?:[A-Z]+[a-z]+){2,}/)
37
+ # end
38
+ #
39
+ # # ...
40
+ # end
41
+ #
42
+ # # create a new page...
43
+ # home_page = WikiPage.new( "HomePage", "James Edward Gray II",
44
+ # "A page about the JoysOfDocumentation..." )
45
+ #
46
+ # # then we want to update page data and the index together, or not at all...
47
+ # wiki = PStore.new("wiki_pages.pstore")
48
+ # wiki.transaction do # begin transaction; do all of this or none of it
49
+ # # store page...
50
+ # wiki[home_page.page_name] = home_page
51
+ # # ensure that an index has been created...
52
+ # wiki[:wiki_index] ||= Array.new
53
+ # # update wiki index...
54
+ # wiki[:wiki_index].push(*home_page.wiki_page_references)
55
+ # end # commit changes to wiki data store file
56
+ #
57
+ # ### Some time later... ###
58
+ #
59
+ # # read wiki data...
60
+ # wiki.transaction(true) do # begin read-only transaction, no changes allowed
61
+ # wiki.roots.each do |data_root_name|
62
+ # p data_root_name
63
+ # p wiki[data_root_name]
64
+ # end
65
+ # end
66
+ #
67
+ # ## Transaction modes
68
+ #
69
+ # By default, file integrity is only ensured as long as the operating system
70
+ # (and the underlying hardware) doesn't raise any unexpected I/O errors. If an
71
+ # I/O error occurs while PStore is writing to its file, then the file will
72
+ # become corrupted.
73
+ #
74
+ # You can prevent this by setting *pstore.ultra_safe = true*. However, this
75
+ # results in a minor performance loss, and only works on platforms that support
76
+ # atomic file renames. Please consult the documentation for `ultra_safe` for
77
+ # details.
78
+ #
79
+ # Needless to say, if you're storing valuable data with PStore, then you should
80
+ # backup the PStore files from time to time.
81
+ #
82
+ class PStore
83
+ public
84
+
85
+ # Retrieves a value from the PStore file data, by *name*. The hierarchy of Ruby
86
+ # objects stored under that root *name* will be returned.
87
+ #
88
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
89
+ # raise PStore::Error if called at any other time.
90
+ #
91
+ def []: (untyped name) -> untyped
92
+
93
+ # Stores an individual Ruby object or a hierarchy of Ruby objects in the data
94
+ # store file under the root *name*. Assigning to a *name* already in the data
95
+ # store clobbers the old data.
96
+ #
97
+ # ## Example:
98
+ #
99
+ # require "pstore"
100
+ #
101
+ # store = PStore.new("data_file.pstore")
102
+ # store.transaction do # begin transaction
103
+ # # load some data into the store...
104
+ # store[:single_object] = "My data..."
105
+ # store[:obj_hierarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"],
106
+ # "James Gray" => ["erb.rb", "pstore.rb"] }
107
+ # end # commit changes to data store file
108
+ #
109
+ # **WARNING**: This method is only valid in a PStore#transaction and it cannot
110
+ # be read-only. It will raise PStore::Error if called at any other time.
111
+ #
112
+ def []=: (untyped name, untyped value) -> untyped
113
+
114
+ # Ends the current PStore#transaction, discarding any changes to the data store.
115
+ #
116
+ # ## Example:
117
+ #
118
+ # require "pstore"
119
+ #
120
+ # store = PStore.new("data_file.pstore")
121
+ # store.transaction do # begin transaction
122
+ # store[:one] = 1 # this change is not applied, see below...
123
+ # store[:two] = 2 # this change is not applied, see below...
124
+ #
125
+ # store.abort # end transaction here, discard all changes
126
+ #
127
+ # store[:three] = 3 # this change is never reached
128
+ # end
129
+ #
130
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
131
+ # raise PStore::Error if called at any other time.
132
+ #
133
+ def abort: () -> untyped
134
+
135
+ # Ends the current PStore#transaction, committing any changes to the data store
136
+ # immediately.
137
+ #
138
+ # ## Example:
139
+ #
140
+ # require "pstore"
141
+ #
142
+ # store = PStore.new("data_file.pstore")
143
+ # store.transaction do # begin transaction
144
+ # # load some data into the store...
145
+ # store[:one] = 1
146
+ # store[:two] = 2
147
+ #
148
+ # store.commit # end transaction here, committing changes
149
+ #
150
+ # store[:three] = 3 # this change is never reached
151
+ # end
152
+ #
153
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
154
+ # raise PStore::Error if called at any other time.
155
+ #
156
+ def commit: () -> nil
157
+
158
+ # Removes an object hierarchy from the data store, by *name*.
159
+ #
160
+ # **WARNING**: This method is only valid in a PStore#transaction and it cannot
161
+ # be read-only. It will raise PStore::Error if called at any other time.
162
+ #
163
+ def delete: (untyped name) -> untyped
164
+
165
+ # This method is just like PStore#[], save that you may also provide a *default*
166
+ # value for the object. In the event the specified *name* is not found in the
167
+ # data store, your *default* will be returned instead. If you do not specify a
168
+ # default, PStore::Error will be raised if the object is not found.
169
+ #
170
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
171
+ # raise PStore::Error if called at any other time.
172
+ #
173
+ def fetch: (untyped name, ?untyped default) -> untyped
174
+
175
+ # Returns the path to the data store file.
176
+ #
177
+ def path: () -> untyped
178
+
179
+ # Returns true if the supplied *name* is currently in the data store.
180
+ #
181
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
182
+ # raise PStore::Error if called at any other time.
183
+ #
184
+ def root?: (untyped name) -> bool
185
+
186
+ # Returns the names of all object hierarchies currently in the store.
187
+ #
188
+ # **WARNING**: This method is only valid in a PStore#transaction. It will
189
+ # raise PStore::Error if called at any other time.
190
+ #
191
+ def roots: () -> Array[untyped]
192
+
193
+ # Opens a new transaction for the data store. Code executed inside a block
194
+ # passed to this method may read and write data to and from the data store file.
195
+ #
196
+ # At the end of the block, changes are committed to the data store
197
+ # automatically. You may exit the transaction early with a call to either
198
+ # PStore#commit or PStore#abort. See those methods for details about how
199
+ # changes are handled. Raising an uncaught Exception in the block is equivalent
200
+ # to calling PStore#abort.
201
+ #
202
+ # If *read_only* is set to `true`, you will only be allowed to read from the
203
+ # data store during the transaction and any attempts to change the data will
204
+ # raise a PStore::Error.
205
+ #
206
+ # Note that PStore does not support nested transactions.
207
+ #
208
+ def transaction: (?untyped read_only) -> untyped
209
+
210
+ # Whether PStore should do its best to prevent file corruptions, even when under
211
+ # unlikely-to-occur error conditions such as out-of-space conditions and other
212
+ # unusual OS filesystem errors. Setting this flag comes at the price in the form
213
+ # of a performance loss.
214
+ #
215
+ # This flag only has effect on platforms on which file renames are atomic (e.g.
216
+ # all POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is
217
+ # false.
218
+ #
219
+ def ultra_safe: () -> untyped
220
+
221
+ def ultra_safe=: (untyped) -> untyped
222
+
223
+ private
224
+
225
+ def dump: (untyped table) -> untyped
226
+
227
+ def empty_marshal_checksum: () -> untyped
228
+
229
+ def empty_marshal_data: () -> untyped
230
+
231
+ # Raises PStore::Error if the calling code is not in a PStore#transaction.
232
+ #
233
+ def in_transaction: () -> untyped
234
+
235
+ # Raises PStore::Error if the calling code is not in a PStore#transaction or if
236
+ # the code is in a read-only PStore#transaction.
237
+ #
238
+ def in_transaction_wr: () -> untyped
239
+
240
+ # To construct a PStore object, pass in the *file* path where you would like the
241
+ # data to be stored.
242
+ #
243
+ # PStore objects are always reentrant. But if *thread_safe* is set to true, then
244
+ # it will become thread-safe at the cost of a minor performance hit.
245
+ #
246
+ def initialize: (untyped file, ?boolish thread_safe) -> untyped
247
+
248
+ def load: (untyped content) -> untyped
249
+
250
+ # Load the given PStore file. If `read_only` is true, the unmarshalled Hash will
251
+ # be returned. If `read_only` is false, a 3-tuple will be returned: the
252
+ # unmarshalled Hash, a checksum of the data, and the size of the data.
253
+ #
254
+ def load_data: (untyped file, untyped read_only) -> untyped
255
+
256
+ def on_windows?: () -> bool
257
+
258
+ # Open the specified filename (either in read-only mode or in read-write mode)
259
+ # and lock it for reading or writing.
260
+ #
261
+ # The opened File object will be returned. If *read_only* is true, and the file
262
+ # does not exist, then nil will be returned.
263
+ #
264
+ # All exceptions are propagated.
265
+ #
266
+ def open_and_lock_file: (untyped filename, untyped read_only) -> untyped
267
+
268
+ def save_data: (untyped original_checksum, untyped original_file_size, untyped file) -> untyped
269
+
270
+ def save_data_with_atomic_file_rename_strategy: (untyped data, untyped file) -> untyped
271
+
272
+ def save_data_with_fast_strategy: (untyped data, untyped file) -> untyped
273
+ end
274
+
275
+ PStore::EMPTY_MARSHAL_CHECKSUM: String
276
+
277
+ PStore::EMPTY_MARSHAL_DATA: String
278
+
279
+ PStore::EMPTY_STRING: String
280
+
281
+ PStore::RDWR_ACCESS: Hash[untyped, untyped]
282
+
283
+ PStore::RD_ACCESS: Hash[untyped, untyped]
284
+
285
+ PStore::VERSION: String
286
+
287
+ PStore::WR_ACCESS: Hash[untyped, untyped]
@@ -66,7 +66,7 @@ module PTY
66
66
  # : If `true` and the process identified by `pid` is no longer alive a
67
67
  # PTY::ChildExited is raised.
68
68
  #
69
- def self.check: (Integer pid, ?bool raise) -> Process::Status?
69
+ def self.check: (Integer pid, ?boolish raise) -> Process::Status?
70
70
 
71
71
  alias self.getpty self.spawn
72
72
 
File without changes
@@ -1,13 +1,13 @@
1
1
  class Dir
2
2
  # Returns the operating system's temporary file path.
3
- #
3
+ #
4
4
  def self.tmpdir: () -> String
5
5
 
6
6
  # Dir.mktmpdir creates a temporary directory.
7
- #
7
+ #
8
8
  # The directory is created with 0700 permission. Application should not change
9
9
  # the permission to make the temporary directory accessible from other users.
10
- #
10
+ #
11
11
  # The prefix and suffix of the name of the directory is specified by the
12
12
  # optional first argument, *prefix_suffix*.
13
13
  # * If it is not specified or nil, "d" is used as the prefix and no suffix is
@@ -15,30 +15,30 @@ class Dir
15
15
  # * If it is a string, it is used as the prefix and no suffix is used.
16
16
  # * If it is an array, first element is used as the prefix and second element
17
17
  # is used as a suffix.
18
- #
19
- #
18
+ #
19
+ #
20
20
  # Dir.mktmpdir {|dir| dir is ".../d..." }
21
21
  # Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
22
22
  # Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
23
- #
23
+ #
24
24
  # The directory is created under Dir.tmpdir or the optional second argument
25
25
  # *tmpdir* if non-nil value is given.
26
- #
26
+ #
27
27
  # Dir.mktmpdir {|dir| dir is "#{Dir.tmpdir}/d..." }
28
28
  # Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
29
- #
29
+ #
30
30
  # If a block is given, it is yielded with the path of the directory. The
31
31
  # directory and its contents are removed using FileUtils.remove_entry before
32
32
  # Dir.mktmpdir returns. The value of the block is returned.
33
- #
33
+ #
34
34
  # Dir.mktmpdir {|dir|
35
35
  # # use the directory...
36
36
  # open("#{dir}/foo", "w") { ... }
37
37
  # }
38
- #
38
+ #
39
39
  # If a block is not given, The path of the directory is returned. In this case,
40
40
  # Dir.mktmpdir doesn't remove the directory.
41
- #
41
+ #
42
42
  # dir = Dir.mktmpdir
43
43
  # begin
44
44
  # # use the directory...
@@ -47,7 +47,7 @@ class Dir
47
47
  # # remove the directory.
48
48
  # FileUtils.remove_entry dir
49
49
  # end
50
- #
50
+ #
51
51
  def self.mktmpdir: (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) -> String
52
52
  | [X] (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) { (String) -> X } -> X
53
53
  end
File without changes
@@ -193,7 +193,7 @@ module URI
193
193
  #
194
194
  # Creates a new URI::Generic instance from ``generic'' components without check.
195
195
  #
196
- def initialize: (String scheme, String userinfo, String host, Integer port, String? registry, String path, String? opaque, String query, String fragment, ?untyped parser, ?bool arg_check) -> URI::Generic
196
+ def initialize: (String scheme, String userinfo, String host, Integer port, String? registry, String path, String? opaque, String query, String fragment, ?untyped parser, ?boolish arg_check) -> URI::Generic
197
197
 
198
198
  #
199
199
  # Returns the scheme component of the URI.
@@ -851,7 +851,7 @@ module URI
851
851
  # uri.coerce("http://foo.com")
852
852
  # #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
853
853
  #
854
- def coerce: ((URI::Generic | String) oth) -> Array[URI::Generic]
854
+ def coerce: (URI::Generic | String oth) -> Array[URI::Generic]
855
855
 
856
856
  # Returns a proxy URI.
857
857
  # The proxy URI is obtained from environment variables such as http_proxy,
@@ -0,0 +1,158 @@
1
+ # URI is a module providing classes to handle Uniform Resource Identifiers
2
+ # ([RFC2396](http://tools.ietf.org/html/rfc2396)).
3
+ #
4
+ # ## Features
5
+ #
6
+ # * Uniform way of handling URIs.
7
+ # * Flexibility to introduce custom URI schemes.
8
+ # * Flexibility to have an alternate URI::Parser (or just different patterns
9
+ # and regexp's).
10
+ #
11
+ #
12
+ # ## Basic example
13
+ #
14
+ # require 'uri'
15
+ #
16
+ # uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
17
+ # #=> #<URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
18
+ #
19
+ # uri.scheme #=> "http"
20
+ # uri.host #=> "foo.com"
21
+ # uri.path #=> "/posts"
22
+ # uri.query #=> "id=30&limit=5"
23
+ # uri.fragment #=> "time=1305298413"
24
+ #
25
+ # uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
26
+ #
27
+ # ## Adding custom URIs
28
+ #
29
+ # module URI
30
+ # class RSYNC < Generic
31
+ # DEFAULT_PORT = 873
32
+ # end
33
+ # @@schemes['RSYNC'] = RSYNC
34
+ # end
35
+ # #=> URI::RSYNC
36
+ #
37
+ # URI.scheme_list
38
+ # #=> {"FILE"=>URI::File, "FTP"=>URI::FTP, "HTTP"=>URI::HTTP,
39
+ # # "HTTPS"=>URI::HTTPS, "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS,
40
+ # # "MAILTO"=>URI::MailTo, "RSYNC"=>URI::RSYNC}
41
+ #
42
+ # uri = URI("rsync://rsync.foo.com")
43
+ # #=> #<URI::RSYNC rsync://rsync.foo.com>
44
+ #
45
+ # ## RFC References
46
+ #
47
+ # A good place to view an RFC spec is http://www.ietf.org/rfc.html.
48
+ #
49
+ # Here is a list of all related RFC's:
50
+ # * [RFC822](http://tools.ietf.org/html/rfc822)
51
+ # * [RFC1738](http://tools.ietf.org/html/rfc1738)
52
+ # * [RFC2255](http://tools.ietf.org/html/rfc2255)
53
+ # * [RFC2368](http://tools.ietf.org/html/rfc2368)
54
+ # * [RFC2373](http://tools.ietf.org/html/rfc2373)
55
+ # * [RFC2396](http://tools.ietf.org/html/rfc2396)
56
+ # * [RFC2732](http://tools.ietf.org/html/rfc2732)
57
+ # * [RFC3986](http://tools.ietf.org/html/rfc3986)
58
+ #
59
+ #
60
+ # ## Class tree
61
+ #
62
+ # * URI::Generic (in uri/generic.rb)
63
+ # * URI::File - (in uri/file.rb)
64
+ # * URI::FTP - (in uri/ftp.rb)
65
+ # * URI::HTTP - (in uri/http.rb)
66
+ # * URI::HTTPS - (in uri/https.rb)
67
+ #
68
+ # * URI::LDAP - (in uri/ldap.rb)
69
+ # * URI::LDAPS - (in uri/ldaps.rb)
70
+ #
71
+ # * URI::MailTo - (in uri/mailto.rb)
72
+ #
73
+ # * URI::Parser - (in uri/common.rb)
74
+ # * URI::REGEXP - (in uri/common.rb)
75
+ # * URI::REGEXP::PATTERN - (in uri/common.rb)
76
+ #
77
+ # * URI::Util - (in uri/common.rb)
78
+ # * URI::Escape - (in uri/common.rb)
79
+ # * URI::Error - (in uri/common.rb)
80
+ # * URI::InvalidURIError - (in uri/common.rb)
81
+ # * URI::InvalidComponentError - (in uri/common.rb)
82
+ # * URI::BadURIError - (in uri/common.rb)
83
+ #
84
+ #
85
+ #
86
+ # ## Copyright Info
87
+ #
88
+ # Author
89
+ # : Akira Yamada <akira@ruby-lang.org>
90
+ # Documentation
91
+ # : Akira Yamada <akira@ruby-lang.org> Dmitry V. Sabanin <sdmitry@lrn.ru>
92
+ # Vincent Batts <vbatts@hashbangbash.com>
93
+ # License
94
+ # : Copyright (c) 2001 akira yamada <akira@ruby-lang.org> You can redistribute
95
+ # it and/or modify it under the same term as Ruby.
96
+ # Revision
97
+ # : $Id$
98
+ #
99
+ #
100
+ module URI
101
+ #
102
+ # The syntax of HTTP URIs is defined in RFC1738 section 3.3.
103
+ #
104
+ # Note that the Ruby URI library allows HTTP URLs containing usernames and
105
+ # passwords. This is not legal as per the RFC, but used to be
106
+ # supported in Internet Explorer 5 and 6, before the MS04-004 security
107
+ # update. See <URL:http://support.microsoft.com/kb/834489>.
108
+ #
109
+ class HTTP < Generic
110
+ # A Default port of 80 for URI::HTTP.
111
+ DEFAULT_PORT: Integer
112
+
113
+ # An Array of the available components for URI::HTTP.
114
+ COMPONENT: Array[Symbol]
115
+
116
+ #
117
+ # == Description
118
+ #
119
+ # Creates a new URI::HTTP object from components, with syntax checking.
120
+ #
121
+ # The components accepted are userinfo, host, port, path, query, and
122
+ # fragment.
123
+ #
124
+ # The components should be provided either as an Array, or as a Hash
125
+ # with keys formed by preceding the component names with a colon.
126
+ #
127
+ # If an Array is used, the components must be passed in the
128
+ # order <code>[userinfo, host, port, path, query, fragment]</code>.
129
+ #
130
+ # Example:
131
+ #
132
+ # uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar')
133
+ #
134
+ # uri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
135
+ # "query", 'fragment'])
136
+ #
137
+ # Currently, if passed userinfo components this method generates
138
+ # invalid HTTP URIs as per RFC 1738.
139
+ #
140
+ def self.build: (Array[String | Integer] args) -> URI::HTTP
141
+ | ({ userinfo: String, host: String, port: Integer, path: String, query: String, fragment: String }) -> URI::HTTP
142
+
143
+ #
144
+ # == Description
145
+ #
146
+ # Returns the full path for an HTTP request, as required by Net::HTTP::Get.
147
+ #
148
+ # If the URI contains a query, the full path is URI#path + '?' + URI#query.
149
+ # Otherwise, the path is simply URI#path.
150
+ #
151
+ # Example:
152
+ #
153
+ # uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true')
154
+ # uri.request_uri # => "/foo/bar?test=true"
155
+ #
156
+ def request_uri: () -> String
157
+ end
158
+ end