rbs 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,102 @@
1
+ module RBS
2
+ module Annotate
3
+ class Annotations
4
+ type t = Skip | Source | Copy
5
+
6
+ def self.parse: (AST::Annotation) -> t?
7
+
8
+ attr_reader items: Array[t]
9
+
10
+ def initialize: (Array[t]) -> void
11
+
12
+ def skip?: () -> bool
13
+
14
+ def skip_all?: () -> bool
15
+
16
+ def test_path: (String path) -> bool
17
+
18
+ def test_path_string: (String pattern, String path) -> bool
19
+
20
+ def copy_annotation: -> Copy?
21
+
22
+ # Skip annotation allows skipping generating annotation of a subject.
23
+ #
24
+ # %a{annotate:rdoc:skip}
25
+ # %a{annotate:rdoc:skip:all}
26
+ #
27
+ class Skip
28
+ attr_reader annotation: AST::Annotation
29
+
30
+ attr_reader skip_children: bool
31
+
32
+ def initialize: (annotation: AST::Annotation, skip_children: bool) -> void
33
+
34
+ def hash: () -> Integer
35
+
36
+ def ==: (untyped) -> bool
37
+
38
+ alias eql? ==
39
+ end
40
+
41
+ # Source annotation allows where the documents are copied from.
42
+ #
43
+ # It allows specifying two directions: the source to read from, and the source to skip.
44
+ #
45
+ # %a{annotate:rdoc:source:from=ext/pathname}
46
+ # %a{annotate:rdoc:source:skip=ext/pathname/doc}
47
+ #
48
+ # When you want to specify several paths, repeat writing the Source annotation.
49
+ #
50
+ class Source
51
+ attr_reader annotation: AST::Annotation
52
+
53
+ attr_reader include_source: String?
54
+ attr_reader skip_source: String?
55
+
56
+ def initialize: (annotation: AST::Annotation, include: String) -> void
57
+ | (annotation: AST::Annotation, skip: String) -> void
58
+
59
+ def hash: () -> Integer
60
+
61
+ def ==: (untyped) -> bool
62
+
63
+ alias eql? ==
64
+ end
65
+
66
+ # Copy annotation allows copying the doc from another subject.
67
+ # This helps working with incorrect RDoc annotations.
68
+ #
69
+ # %a{annotate:rdoc:copy:Bar#baz}
70
+ # %a{annotate:rdoc:copy:Bar.baz}
71
+ # %a{annotate:rdoc:copy:Bar::Baz}
72
+ #
73
+ class Copy
74
+ attr_reader annotation: AST::Annotation
75
+
76
+ attr_reader source: String
77
+
78
+ def initialize: (annotation: AST::Annotation, source: String) -> void
79
+
80
+ # Returns a tuple of:
81
+ #
82
+ # - Type name
83
+ # - A pair of:
84
+ # - Boolean which holds if it is singleton
85
+ # - Name of method
86
+ def partition: () -> [TypeName, [bool, Symbol]?]
87
+
88
+ def type_name: () -> TypeName
89
+
90
+ def method_name: () -> Symbol?
91
+
92
+ def singleton?: () -> bool
93
+
94
+ def hash: () -> Integer
95
+
96
+ def ==: (untyped) -> bool
97
+
98
+ alias eql? ==
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,24 @@
1
+ module RBS
2
+ module Annotate
3
+ class Formatter
4
+ attr_reader buffer: String
5
+
6
+ @pending_separator: String?
7
+
8
+ def initialize: () -> void
9
+
10
+ def <<: (String | RDoc::Markup::Document | nil) -> self
11
+
12
+ def margin: (?separator: String) -> self
13
+
14
+ def empty?: () -> bool
15
+
16
+ def format: (newline_at_end: bool) -> String
17
+
18
+ def self.translate: (RDoc::Markup::Document) -> String?
19
+
20
+ def self.each_part: (RDoc::Markup::Document) { (RDoc::Markup::Document) -> void } -> void
21
+ | (RDoc::Markup::Document) -> Enumerator[RDoc::Markup::Document, void]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,82 @@
1
+ module RBS
2
+ module Annotate
3
+ class RDocAnnotator
4
+ attr_reader source: RDocSource
5
+
6
+ attr_accessor include_arg_lists: bool
7
+ attr_accessor include_filename: bool
8
+
9
+ def initialize: (source: RDocSource) -> void
10
+
11
+ def annotate_file: (Pathname) -> void
12
+
13
+ def annotate_decls: (Array[AST::Declarations::t], ?outer: Array[Namespace]) -> void
14
+
15
+ interface _PathTester
16
+ def test_path: (String) -> bool
17
+ end
18
+
19
+ interface _WithRDocComment
20
+ def comment: () -> RDoc::Markup::Document
21
+ end
22
+
23
+ def each_part: (Array[Object & _WithRDocComment], tester: _PathTester) { ([RDoc::Markup::Document, Object & _WithRDocComment]) -> void } -> void
24
+ | (Array[Object & _WithRDocComment], tester: _PathTester) -> Enumerator[[RDoc::Markup::Document, Object & _WithRDocComment], void]
25
+
26
+ def join_docs: (Array[String?], ?separator: String) -> String?
27
+
28
+ def doc_for_class: (TypeName, tester: _PathTester) -> String?
29
+
30
+ # Returns the formatted document of given method.
31
+ #
32
+ # Expands attribute documents, or alias documents if needed.
33
+ #
34
+ def doc_for_method: (TypeName, instance_method: Symbol, tester: _PathTester) -> String?
35
+ | (TypeName, singleton_method: Symbol, tester: _PathTester) -> String?
36
+
37
+
38
+ def doc_for_method0: (TypeName, instance_method: Symbol, tester: _PathTester) -> String?
39
+ | (TypeName, singleton_method: Symbol, tester: _PathTester) -> String?
40
+
41
+ # Having `require: nil` means any attribute is okay.
42
+ # Having `require: "R"` means _read attr_ is required.
43
+ # Having `require: "W"` means write attr_ is required.
44
+ #
45
+ def doc_for_attribute: (TypeName, Symbol, singleton: bool, ?require: nil | "R" | "W", tester: _PathTester) -> String?
46
+
47
+ def doc_for_alias: (TypeName, name: Symbol, singleton: bool, tester: _PathTester) -> String?
48
+
49
+ def doc_for_constant: (TypeName, tester: _PathTester) -> String?
50
+
51
+ def resolve_doc_source: (Annotations::Copy?, tester: _PathTester) { () -> String? } -> String?
52
+
53
+ def annotate_class: (AST::Declarations::Class | AST::Declarations::Module, outer: Array[Namespace]) -> void
54
+
55
+ def annotate_constant: (AST::Declarations::Constant, outer: Array[Namespace]) -> void
56
+
57
+ def annotate_method: (TypeName, AST::Members::MethodDefinition) -> void
58
+
59
+ def annotate_alias: (TypeName, AST::Members::Alias) -> void
60
+
61
+ def annotate_attribute: (TypeName, AST::Members::AttrReader | AST::Members::AttrWriter | AST::Members::AttrAccessor) -> void
62
+
63
+ def annotations: (_Annotated) -> Annotations
64
+
65
+ interface _Annotated
66
+ def annotations: -> Array[AST::Annotation]
67
+ end
68
+
69
+ # - If a string is given as `comment`, the content is attached to the object as a comment.
70
+ # - If empty string is given as `comment`, it deletes the original comment.
71
+ # - If `nil` is given as `comment`, it keeps the original comment.
72
+ #
73
+ def replace_comment: (Object & _Commented, String? comment) -> void
74
+
75
+ interface _Commented
76
+ def comment: () -> AST::Comment?
77
+ end
78
+
79
+ def resolve_name: (TypeName, outer: Array[Namespace]) -> TypeName
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,30 @@
1
+ module RBS
2
+ module Annotate
3
+ class RDocSource
4
+ attr_accessor with_system_dir: bool
5
+ attr_accessor with_gems_dir: bool
6
+ attr_accessor with_site_dir: bool
7
+ attr_accessor with_home_dir: bool
8
+
9
+ attr_reader extra_dirs: Array[Pathname]
10
+
11
+ attr_reader stores: Array[RDoc::Store]
12
+
13
+ def initialize: () -> void
14
+
15
+ def load: () -> void
16
+
17
+ # Extract documents from `CodeObject`s
18
+ def docs: () { () -> Array[RDoc::CodeObject]? } -> Array[RDoc::Markup::Document]?
19
+
20
+ def find_class: (TypeName) -> Array[RDoc::ClassModule]?
21
+
22
+ def find_const: (TypeName) -> Array[RDoc::Constant]?
23
+
24
+ def find_method: (TypeName, instance_method: Symbol) -> Array[RDoc::AnyMethod]?
25
+ | (TypeName, singleton_method: Symbol) -> Array[RDoc::AnyMethod]?
26
+
27
+ def find_attribute: (TypeName, Symbol, singleton: bool) -> Array[RDoc::Attr]?
28
+ end
29
+ end
30
+ end
data/sig/cli.rbs CHANGED
@@ -66,6 +66,8 @@ module RBS
66
66
 
67
67
  def run_collection: (Array[String], LibraryOptions) -> void
68
68
 
69
+ def run_annotate: (Array[String], top) -> void
70
+
69
71
  def test_opt: (LibraryOptions) -> String?
70
72
 
71
73
  def collection_options: (Array[String]) -> OptionParser
File without changes
data/sig/location.rbs CHANGED
@@ -87,6 +87,12 @@ module RBS
87
87
  def each_required_key: () { (Symbol) -> void } -> void
88
88
  | () -> Enumerator[Symbol, void]
89
89
 
90
+ def optional_key?: (Symbol) -> bool
91
+
92
+ def required_key?: (Symbol) -> bool
93
+
94
+ def key?: (Symbol) -> bool
95
+
90
96
  private
91
97
 
92
98
  def _start_loc: () -> Buffer::loc?
data/sig/method_types.rbs CHANGED
@@ -7,7 +7,11 @@ module RBS
7
7
  # ^^^ type_params
8
8
  # ^^^^^^^^^^^^^^^^^^^ type
9
9
  #
10
- type loc = Location[:type, :type_params]
10
+ type def_loc = Location[:type, :type_params]
11
+
12
+ type attr_loc = AST::Members::Attribute::loc
13
+
14
+ type loc = def_loc | attr_loc
11
15
 
12
16
  attr_reader type_params: Array[AST::TypeParam]
13
17
  attr_reader type: Types::Function
data/sig/polyfill.rbs CHANGED
@@ -25,3 +25,81 @@ module Bundler
25
25
  def version: () -> String
26
26
  end
27
27
  end
28
+
29
+ module RDoc
30
+ class Store
31
+ def initialize: (?String? path, ?Symbol? type) -> void
32
+
33
+ def find_class_or_module: (String) -> ClassModule?
34
+
35
+ def load_all: () -> void
36
+ end
37
+
38
+ module RI
39
+ module Paths
40
+ type path_type = :system | :site | :home | :gem | :extra
41
+
42
+ type gem_filter = :latest | :all
43
+
44
+ def self.each: (?bool system, ?bool site, ?bool home, ?gem_filter | false gems, *String extra_dirs) { (String, path_type) -> void } -> void
45
+ end
46
+ end
47
+
48
+ class CodeObject
49
+ def comment: () -> RDoc::Markup::Document
50
+ end
51
+
52
+ class Context < CodeObject
53
+
54
+ end
55
+
56
+ class ClassModule < Context
57
+ def constants: () -> Array[Constant]
58
+
59
+ def method_list: () -> Array[AnyMethod]
60
+
61
+ def attributes: () -> Array[Attr]
62
+ end
63
+
64
+ class Constant < CodeObject
65
+ def name: () -> String
66
+ end
67
+
68
+ class AnyMethod < MethodAttr
69
+ def arglists: () -> String?
70
+
71
+ def callseq: () -> String?
72
+ end
73
+
74
+ class MethodAttr < CodeObject
75
+ attr_reader name: String
76
+
77
+ attr_reader singleton: bool
78
+
79
+ attr_reader is_alias_for: MethodAttr?
80
+
81
+ attr_reader call_seq: String
82
+
83
+ attr_reader arglists: String
84
+ end
85
+
86
+ class Attr < MethodAttr
87
+ attr_accessor rw: "RW" | "R" | "W"
88
+ end
89
+
90
+ module Markup
91
+ class Document
92
+ include Enumerable[Document]
93
+
94
+ def each: () { (Document) -> void } -> void
95
+ | () -> Enumerator[Document, void]
96
+
97
+ def file: () -> String?
98
+
99
+ def accept: (untyped) -> String
100
+ end
101
+
102
+ class ToMarkdown
103
+ end
104
+ end
105
+ end
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=lib/abbrev.rb -->
1
2
  # Calculates the set of unambiguous abbreviations for a given set of strings.
2
3
  #
3
4
  # require 'abbrev'
@@ -34,6 +35,10 @@
34
35
  # "w" => "winter" }
35
36
  #
36
37
  module Abbrev
38
+ # <!--
39
+ # rdoc-file=lib/abbrev.rb
40
+ # - abbrev(words, pattern = nil)
41
+ # -->
37
42
  # Given a set of strings, calculate the set of unambiguous abbreviations for
38
43
  # those strings, and return a hash where the keys are all the possible
39
44
  # abbreviations and the values are the full strings.
@@ -56,5 +61,6 @@ module Abbrev
56
61
  #
57
62
  # Abbrev.abbrev(%w{car box cone}, 'ca')
58
63
  # #=> {"car"=>"car", "ca"=>"car"}
64
+ #
59
65
  def self?.abbrev: (Array[String], ?String | Regexp | nil) -> Hash[String, String]
60
66
  end
@@ -0,0 +1,26 @@
1
+ %a{annotate:rdoc:skip}
2
+ class Array[unchecked out Elem]
3
+ # <!--
4
+ # rdoc-file=lib/abbrev.rb
5
+ # - abbrev(pattern = nil)
6
+ # -->
7
+ # Calculates the set of unambiguous abbreviations for the strings in `self`.
8
+ #
9
+ # require 'abbrev'
10
+ # %w{ car cone }.abbrev
11
+ # #=> {"car"=>"car", "ca"=>"car", "cone"=>"cone", "con"=>"cone", "co"=>"cone"}
12
+ #
13
+ # The optional `pattern` parameter is a pattern or a string. Only input strings
14
+ # that match the pattern or start with the string are included in the output
15
+ # hash.
16
+ #
17
+ # %w{ fast boat day }.abbrev(/^.a/)
18
+ # #=> {"fast"=>"fast", "fas"=>"fast", "fa"=>"fast", "day"=>"day", "da"=>"day"}
19
+ #
20
+ # Abbrev.abbrev(%w{car box cone}, "ca")
21
+ # #=> {"car"=>"car", "ca"=>"car"}
22
+ #
23
+ # See also Abbrev.abbrev
24
+ #
25
+ def abbrev: (?String | Regexp | nil) -> Hash[String, String]
26
+ end
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=lib/base64.rb -->
1
2
  # The Base64 module provides for the encoding (#encode64, #strict_encode64,
2
3
  # #urlsafe_encode64) and decoding (#decode64, #strict_decode64,
3
4
  # #urlsafe_decode64) of binary data using a Base64 representation.
@@ -17,6 +18,10 @@
17
18
  # data into purely printable characters.
18
19
  #
19
20
  module Base64
21
+ # <!--
22
+ # rdoc-file=lib/base64.rb
23
+ # - decode64(str)
24
+ # -->
20
25
  # Returns the Base64-decoded version of `str`. This method complies with RFC
21
26
  # 2045. Characters outside the base alphabet are ignored.
22
27
  #
@@ -32,8 +37,13 @@ module Base64
32
37
  # This is line two
33
38
  # This is line three
34
39
  # And so on...
40
+ #
35
41
  def self?.decode64: (String str) -> String
36
42
 
43
+ # <!--
44
+ # rdoc-file=lib/base64.rb
45
+ # - encode64(bin)
46
+ # -->
37
47
  # Returns the Base64-encoded version of `bin`. This method complies with RFC
38
48
  # 2045. Line feeds are added to every 60 encoded characters.
39
49
  #
@@ -44,28 +54,49 @@ module Base64
44
54
  #
45
55
  # Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
46
56
  # UnVieQ==
57
+ #
47
58
  def self?.encode64: (String bin) -> String
48
59
 
60
+ # <!--
61
+ # rdoc-file=lib/base64.rb
62
+ # - strict_decode64(str)
63
+ # -->
49
64
  # Returns the Base64-decoded version of `str`. This method complies with RFC
50
65
  # 4648. ArgumentError is raised if `str` is incorrectly padded or contains
51
66
  # non-alphabet characters. Note that CR or LF are also rejected.
67
+ #
52
68
  def self?.strict_decode64: (String str) -> String
53
69
 
70
+ # <!--
71
+ # rdoc-file=lib/base64.rb
72
+ # - strict_encode64(bin)
73
+ # -->
54
74
  # Returns the Base64-encoded version of `bin`. This method complies with RFC
55
75
  # 4648. No line feeds are added.
76
+ #
56
77
  def self?.strict_encode64: (String bin) -> String
57
78
 
79
+ # <!--
80
+ # rdoc-file=lib/base64.rb
81
+ # - urlsafe_decode64(str)
82
+ # -->
58
83
  # Returns the Base64-decoded version of `str`. This method complies with ``Base
59
84
  # 64 Encoding with URL and Filename Safe Alphabet'' in RFC 4648. The alphabet
60
85
  # uses '-' instead of '+' and '_' instead of '/'.
61
86
  #
62
87
  # The padding character is optional. This method accepts both correctly-padded
63
88
  # and unpadded input. Note that it still rejects incorrectly-padded input.
89
+ #
64
90
  def self?.urlsafe_decode64: (String str) -> String
65
91
 
92
+ # <!--
93
+ # rdoc-file=lib/base64.rb
94
+ # - urlsafe_encode64(bin, padding: true)
95
+ # -->
66
96
  # Returns the Base64-encoded version of `bin`. This method complies with ``Base
67
97
  # 64 Encoding with URL and Filename Safe Alphabet'' in RFC 4648. The alphabet
68
98
  # uses '-' instead of '+' and '_' instead of '/'. Note that the result can still
69
99
  # contain '='. You can remove the padding by setting `padding` as false.
100
+ #
70
101
  def self?.urlsafe_encode64: (String bin, ?padding: boolish) -> String
71
102
  end