rbs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
@@ -1,2 +1,15 @@
1
+ # <!-- rdoc-file=lib/rubygems/source_list.rb -->
2
+ # The SourceList represents the sources rubygems has been configured to use. A
3
+ # source may be created from an array of sources:
4
+ #
5
+ # Gem::SourceList.from %w[https://rubygems.example https://internal.example]
6
+ #
7
+ # Or by adding them:
8
+ #
9
+ # sources = Gem::SourceList.new
10
+ # sources << 'https://rubygems.example'
11
+ #
12
+ # The most common way to get a SourceList is Gem.sources.
13
+ #
1
14
  class Gem::SourceList
2
15
  end
@@ -1,3 +1,23 @@
1
+ # <!-- rdoc-file=lib/rubygems/specification.rb -->
2
+ # The Specification class contains the information for a gem. Typically defined
3
+ # in a .gemspec file or a Rakefile, and looks like this:
4
+ #
5
+ # Gem::Specification.new do |s|
6
+ # s.name = 'example'
7
+ # s.version = '0.1.0'
8
+ # s.licenses = ['MIT']
9
+ # s.summary = "This is an example!"
10
+ # s.description = "Much longer explanation of the example!"
11
+ # s.authors = ["Ruby Coder"]
12
+ # s.email = 'rubycoder@example.com'
13
+ # s.files = ["lib/example.rb"]
14
+ # s.homepage = 'https://rubygems.org/gems/example'
15
+ # s.metadata = { "source_code_uri" => "https://github.com/example/example" }
16
+ # end
17
+ #
18
+ # Starting in RubyGems 2.0, a Specification can hold arbitrary metadata. See
19
+ # #metadata for restrictions on the format and size of metadata items you may
20
+ # add to a specification.
21
+ #
1
22
  class Gem::Specification < Gem::BasicSpecification
2
- # TODO: Add sinatures...
3
23
  end
@@ -1,3 +1,5 @@
1
+ # <!-- rdoc-file=lib/rubygems/user_interaction.rb -->
2
+ # Gem::StreamUI implements a simple stream based user interface.
3
+ #
1
4
  class Gem::StreamUI
2
- # TODO: Add sinatures...
3
5
  end
@@ -1,3 +1,10 @@
1
+ # <!-- rdoc-file=lib/rubygems/uninstaller.rb -->
2
+ # An Uninstaller.
3
+ #
4
+ # The uninstaller fires pre and post uninstall hooks. Hooks can be added either
5
+ # through a rubygems_plugin.rb file in an installed gem or via a
6
+ # rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb
7
+ # file. See Gem.pre_uninstall and Gem.post_uninstall for details.
8
+ #
1
9
  class Gem::Uninstaller
2
- # TODO: Add sinatures...
3
10
  end
@@ -1,168 +1,20 @@
1
+ %a{annotate:rdoc:skip}
1
2
  module Gem
2
- # The Version class processes string versions into comparable values. A version
3
- # string should normally be a series of numbers separated by periods. Each part
4
- # (digits separated by periods) is considered its own number, and these are used
5
- # for sorting. So for instance, 3.10 sorts higher than 3.2 because ten is
6
- # greater than two.
7
- #
8
- # If any part contains letters (currently only a-z are supported) then that
9
- # version is considered prerelease. Versions with a prerelease part in the Nth
10
- # part sort less than versions with N-1 parts. Prerelease parts are sorted
11
- # alphabetically using the normal Ruby string sorting rules. If a prerelease
12
- # part contains both letters and numbers, it will be broken into multiple parts
13
- # to provide expected sort behavior (1.0.a10 becomes 1.0.a.10, and is greater
14
- # than 1.0.a9).
15
- #
16
- # Prereleases sort between real releases (newest to oldest):
17
- #
18
- # 1. 1.0
19
- # 2. 1.0.b1
20
- # 3. 1.0.a.2
21
- # 4. 0.9
22
- #
23
- #
24
- # If you want to specify a version restriction that includes both prereleases
25
- # and regular releases of the 1.x series this is the best way:
26
- #
27
- # s.add_dependency 'example', '>= 1.0.0.a', '< 2.0.0'
28
- #
29
- # ## How Software Changes
30
- #
31
- # Users expect to be able to specify a version constraint that gives them some
32
- # reasonable expectation that new versions of a library will work with their
33
- # software if the version constraint is true, and not work with their software
34
- # if the version constraint is false. In other words, the perfect system will
35
- # accept all compatible versions of the library and reject all incompatible
36
- # versions.
37
- #
38
- # Libraries change in 3 ways (well, more than 3, but stay focused here!).
39
- #
40
- # 1. The change may be an implementation detail only and have no effect on the
41
- # client software.
42
- # 2. The change may add new features, but do so in a way that client software
43
- # written to an earlier version is still compatible.
44
- # 3. The change may change the public interface of the library in such a way
45
- # that old software is no longer compatible.
46
- #
47
- #
48
- # Some examples are appropriate at this point. Suppose I have a Stack class
49
- # that supports a `push` and a `pop` method.
50
- #
51
- # ### Examples of Category 1 changes:
52
- #
53
- # * Switch from an array based implementation to a linked-list based
54
- # implementation.
55
- # * Provide an automatic (and transparent) backing store for large stacks.
56
- #
57
- #
58
- # ### Examples of Category 2 changes might be:
59
- #
60
- # * Add a `depth` method to return the current depth of the stack.
61
- # * Add a `top` method that returns the current top of stack (without changing
62
- # the stack).
63
- # * Change `push` so that it returns the item pushed (previously it had no
64
- # usable return value).
65
- #
66
- #
67
- # ### Examples of Category 3 changes might be:
68
- #
69
- # * Changes `pop` so that it no longer returns a value (you must use `top` to
70
- # get the top of the stack).
71
- # * Rename the methods to `push_item` and `pop_item`.
72
- #
73
- #
74
- # ## RubyGems Rational Versioning
75
- #
76
- # * Versions shall be represented by three non-negative integers, separated by
77
- # periods (e.g. 3.1.4). The first integers is the "major" version number,
78
- # the second integer is the "minor" version number, and the third integer is
79
- # the "build" number.
80
- #
81
- # * A category 1 change (implementation detail) will increment the build
82
- # number.
83
- #
84
- # * A category 2 change (backwards compatible) will increment the minor
85
- # version number and reset the build number.
86
- #
87
- # * A category 3 change (incompatible) will increment the major build number
88
- # and reset the minor and build numbers.
89
- #
90
- # * Any "public" release of a gem should have a different version. Normally
91
- # that means incrementing the build number. This means a developer can
92
- # generate builds all day long, but as soon as they make a public release,
93
- # the version must be updated.
94
- #
95
- #
96
- # ### Examples
97
- #
98
- # Let's work through a project lifecycle using our Stack example from above.
99
- #
100
- # Version 0.0.1
101
- # : The initial Stack class is release.
102
- # Version 0.0.2
103
- # : Switched to a linked=list implementation because it is cooler.
104
- # Version 0.1.0
105
- # : Added a `depth` method.
106
- # Version 1.0.0
107
- # : Added `top` and made `pop` return nil (`pop` used to return the old top
108
- # item).
109
- # Version 1.1.0
110
- # : `push` now returns the value pushed (it used it return nil).
111
- # Version 1.1.1
112
- # : Fixed a bug in the linked list implementation.
113
- # Version 1.1.2
114
- # : Fixed a bug introduced in the last fix.
115
- #
116
- #
117
- # Client A needs a stack with basic push/pop capability. They write to the
118
- # original interface (no `top`), so their version constraint looks like:
119
- #
120
- # gem 'stack', '>= 0.0'
121
- #
122
- # Essentially, any version is OK with Client A. An incompatible change to the
123
- # library will cause them grief, but they are willing to take the chance (we
124
- # call Client A optimistic).
125
- #
126
- # Client B is just like Client A except for two things: (1) They use the `depth`
127
- # method and (2) they are worried about future incompatibilities, so they write
128
- # their version constraint like this:
129
- #
130
- # gem 'stack', '~> 0.1'
131
- #
132
- # The `depth` method was introduced in version 0.1.0, so that version or
133
- # anything later is fine, as long as the version stays below version 1.0 where
134
- # incompatibilities are introduced. We call Client B pessimistic because they
135
- # are worried about incompatible future changes (it is OK to be pessimistic!).
136
- #
137
- # ## Preventing Version Catastrophe:
138
- #
139
- # From: http://blog.zenspider.com/2008/10/rubygems-howto-preventing-cata.html
140
- #
141
- # Let's say you're depending on the fnord gem version 2.y.z. If you specify your
142
- # dependency as ">= 2.0.0" then, you're good, right? What happens if fnord 3.0
143
- # comes out and it isn't backwards compatible with 2.y.z? Your stuff will break
144
- # as a result of using ">=". The better route is to specify your dependency with
145
- # an "approximate" version specifier ("~>"). They're a tad confusing, so here is
146
- # how the dependency specifiers work:
147
- #
148
- # Specification From ... To (exclusive)
149
- # ">= 3.0" 3.0 ... &infin;
150
- # "~> 3.0" 3.0 ... 4.0
151
- # "~> 3.0.0" 3.0.0 ... 3.1
152
- # "~> 3.5" 3.5 ... 4.0
153
- # "~> 3.5.0" 3.5.0 ... 3.6
154
- # "~> 3" 3.0 ... 4.0
155
- #
156
- # For the last example, single-digit versions are automatically extended with a
157
- # zero to give a sensible result.
158
- #
159
3
  class Version
160
4
  include Comparable
161
5
 
6
+ # <!--
7
+ # rdoc-file=lib/rubygems/version.rb
8
+ # - correct?(version)
9
+ # -->
162
10
  # True if the `version` string matches RubyGems' requirements.
163
11
  #
164
12
  def self.correct?: (_ToS version) -> bool
165
13
 
14
+ # <!--
15
+ # rdoc-file=lib/rubygems/version.rb
16
+ # - create(input)
17
+ # -->
166
18
  # Factory method to create a Version object. Input may be a Version or a String.
167
19
  # Intended to simplify client code.
168
20
  #
@@ -173,20 +25,37 @@ module Gem
173
25
  def self.create: (_ToS | Version input) -> instance
174
26
  | (nil input) -> nil
175
27
 
28
+ # <!--
29
+ # rdoc-file=lib/rubygems/version.rb
30
+ # - new(version)
31
+ # -->
176
32
  # Constructs a Version from the `version` string. A version string is a series
177
33
  # of digits or ASCII letters separated by dots.
178
34
  #
179
35
  def initialize: (_ToS version) -> void
180
36
 
37
+ # <!--
38
+ # rdoc-file=lib/rubygems/version.rb
39
+ # - <=>(other)
40
+ # -->
41
+ # Compares this version with `other` returning -1, 0, or 1 if the other version
181
42
  # is larger, the same, or smaller than this one. Attempts to compare to
182
43
  # something that's not a `Gem::Version` return `nil`.
183
44
  #
184
45
  def <=>: (untyped other) -> Integer?
185
46
 
47
+ # <!--
48
+ # rdoc-file=lib/rubygems/version.rb
49
+ # - approximate_recommendation()
50
+ # -->
186
51
  # A recommended version for use with a ~> Requirement.
187
52
  #
188
53
  def approximate_recommendation: () -> String
189
54
 
55
+ # <!--
56
+ # rdoc-file=lib/rubygems/version.rb
57
+ # - bump()
58
+ # -->
190
59
  # Return a new version object where the next to the last revision number is one
191
60
  # greater (e.g., 5.3.1 => 5.4).
192
61
  #
@@ -194,36 +63,70 @@ module Gem
194
63
  #
195
64
  def bump: () -> instance
196
65
 
66
+ # <!--
67
+ # rdoc-file=lib/rubygems/version.rb
68
+ # - canonical_segments()
69
+ # -->
70
+ #
197
71
  def canonical_segments: () -> Array[Integer | String]
198
72
 
73
+ # <!--
74
+ # rdoc-file=lib/rubygems/version.rb
75
+ # - eql?(other)
76
+ # -->
199
77
  # A Version is only eql? to another version if it's specified to the same
200
78
  # precision. Version "1.0" is not the same as version "1".
201
79
  #
202
80
  def eql?: (untyped other) -> bool
203
81
 
82
+ # <!--
83
+ # rdoc-file=lib/rubygems/version.rb
84
+ # - marshal_dump()
85
+ # -->
204
86
  # Dump only the raw version string, not the complete object. It's a string for
205
87
  # backwards (RubyGems 1.3.5 and earlier) compatibility.
206
88
  #
207
89
  def marshal_dump: () -> Array[String]
208
90
 
91
+ # <!--
92
+ # rdoc-file=lib/rubygems/version.rb
93
+ # - marshal_load(array)
94
+ # -->
209
95
  # Load custom marshal format. It's a string for backwards (RubyGems 1.3.5 and
210
96
  # earlier) compatibility.
211
97
  #
212
98
  def marshal_load: (Array[String] array) -> void
213
99
 
100
+ # <!--
101
+ # rdoc-file=lib/rubygems/version.rb
102
+ # - prerelease?()
103
+ # -->
214
104
  # A version is considered a prerelease if it contains a letter.
215
105
  #
216
106
  def prerelease?: () -> bool
217
107
 
108
+ # <!--
109
+ # rdoc-file=lib/rubygems/version.rb
110
+ # - release()
111
+ # -->
218
112
  # The release for this version (e.g. 1.2.0.a -> 1.2.0). Non-prerelease versions
219
113
  # return themselves.
220
114
  #
221
115
  def release: () -> instance
222
116
 
117
+ # <!--
118
+ # rdoc-file=lib/rubygems/version.rb
119
+ # - version()
120
+ # -->
223
121
  # A string representation of this Version.
224
122
  #
225
123
  def version: () -> String
226
124
 
125
+ # <!--
126
+ # rdoc-file=lib/rubygems/version.rb
127
+ # - to_s()
128
+ # -->
129
+ #
227
130
  alias to_s version
228
131
  end
229
132
  end
@@ -1,13 +1,57 @@
1
+ # <!-- rdoc-file=lib/securerandom.rb -->
2
+ # ## Secure random number generator interface.
3
+ #
4
+ # This library is an interface to secure random number generators which are
5
+ # suitable for generating session keys in HTTP cookies, etc.
6
+ #
7
+ # You can use this library in your application by requiring it:
8
+ #
9
+ # require 'securerandom'
10
+ #
11
+ # It supports the following secure random number generators:
12
+ #
13
+ # * openssl
14
+ # * /dev/urandom
15
+ # * Win32
16
+ #
17
+ #
18
+ # SecureRandom is extended by the Random::Formatter module which defines the
19
+ # following methods:
20
+ #
21
+ # * alphanumeric
22
+ # * base64
23
+ # * choose
24
+ # * gen_random
25
+ # * hex
26
+ # * rand
27
+ # * random_bytes
28
+ # * random_number
29
+ # * urlsafe_base64
30
+ # * uuid
31
+ #
32
+ #
33
+ # These methods are usable as class methods of SecureRandom such as
34
+ # `SecureRandom.hex`.
35
+ #
36
+ # If a secure random number generator is not available, `NotImplementedError` is
37
+ # raised.
38
+ #
1
39
  module SecureRandom
2
40
  extend Random::Formatter
3
41
 
4
42
  def self.alphanumeric: (?Integer?) -> String
43
+
5
44
  def self.base64: (?Integer?) -> String
45
+
6
46
  def self.hex: (?Integer?) -> String
47
+
7
48
  def self.random_bytes: (?Integer?) -> String
49
+
8
50
  def self.random_number: () -> Float
9
51
  | (Integer) -> Integer
10
52
  | (Numeric) -> Numeric
53
+
11
54
  def self.urlsafe_base64: (?Integer?, ?bool?) -> String
55
+
12
56
  def self.uuid: () -> String
13
57
  end