mangrove 0.21.1 → 0.21.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15bc54f766e81fef492f0cdbd3bc73879c69a50710ee11674344e19fbe8246a9
4
- data.tar.gz: 046a5ed4212366dae32a8219753ee37ea697fcca3b10dc96a66621186a754fb0
3
+ metadata.gz: 614ac5851a78950c569f55d16aeba8fd0e1d30c11de41912bdd5cd71ee946a0c
4
+ data.tar.gz: 4a67c0db80f4b2f2e79e544edf8baa8bdb86781f12575269c2e52d7c691cbc7d
5
5
  SHA512:
6
- metadata.gz: 59c9a4b90cdb6170254dd976b9b5d145ae0a2557c6e13e38d001e242838aad40b9a47784dc58df434484f3d0a9f334a0061c5f45c538c8d46ca265ffd64d889e
7
- data.tar.gz: 390a1fb98c4e6cb381561653358d8e5365700b66e32b8ee0e2d8c5ab8eb7f2f9025d5cac4a33818d088af1f9fc7cbf56be6a33e852a59dc82167cf680a332244
6
+ metadata.gz: fe09a873d6d1ea23dd9708763d9bb9235176843f581309631918b1bd9a5a52b52e0c9d7948afb649aa968d1bae5538a81786695fdea1f18401bbb0f5cb9c446b
7
+ data.tar.gz: 7c8a24200e2a1add424b6cb2e4117bf22161cd7765c31f9588350e88b500a50485bfe6c60255d99cef8391b35e695e116a2a4725df9d1e6fa4119d49e1e4da63
@@ -0,0 +1,6 @@
1
+ {
2
+ "cSpell.words": [
3
+ "ordinare",
4
+ "ruboclean"
5
+ ]
6
+ }
data/README.md CHANGED
@@ -112,13 +112,8 @@ expect(MyController.new.create("invalid")).to eq "other: invalid value for Integ
112
112
  Other examples are available at [`spec/**/**_spec.rb`](https://github.com/kazzix14/mangrove/tree/main/spec).
113
113
 
114
114
  ## Features
115
- Most features are not implemented.
116
-
117
- - [x] Option Type
118
- - [x] Result Type
119
- - [ ] Builder Type Factory
120
- - [ ] Auto Implementation
121
- - [ ] TODO
115
+ - Option Type
116
+ - Result Type
122
117
 
123
118
  ## Installation
124
119
 
@@ -125,9 +125,9 @@ module Mangrove
125
125
  end
126
126
  end
127
127
 
128
- sig { type_parameters(:OkType, :ErrType).params(inner: T.type_parameter(:OkType)).returns(Result::Ok[T.type_parameter(:OkType), T.type_parameter(:ErrType)]) }
128
+ sig { type_parameters(:OkType).params(inner: T.type_parameter(:OkType)).returns(Result::Ok[T.type_parameter(:OkType), T.untyped]) }
129
129
  def ok(inner)
130
- Result::Ok[T.type_parameter(:OkType), T.type_parameter(:ErrType)].new(inner)
130
+ Result::Ok[T.type_parameter(:OkType), T.untyped].new(inner)
131
131
  end
132
132
 
133
133
  sig { type_parameters(:OkType, :ErrType).params(inner: T.type_parameter(:OkType), _t_err: T::Class[T.type_parameter(:ErrType)]).returns(Result::Ok[T.type_parameter(:OkType), T.type_parameter(:ErrType)]) }
@@ -135,9 +135,9 @@ module Mangrove
135
135
  Result::Ok[T.type_parameter(:OkType), T.type_parameter(:ErrType)].new(inner)
136
136
  end
137
137
 
138
- sig { type_parameters(:OkType, :ErrType).params(inner: T.type_parameter(:ErrType)).returns(Result::Err[T.type_parameter(:OkType), T.type_parameter(:ErrType)]) }
138
+ sig { type_parameters(:ErrType).params(inner: T.type_parameter(:ErrType)).returns(Result::Err[T.untyped, T.type_parameter(:ErrType)]) }
139
139
  def err(inner)
140
- Result::Err[T.type_parameter(:OkType), T.type_parameter(:ErrType)].new(inner)
140
+ Result::Err[T.untyped, T.type_parameter(:ErrType)].new(inner)
141
141
  end
142
142
 
143
143
  sig { type_parameters(:OkType, :ErrType).params(_t_ok: T::Class[T.type_parameter(:OkType)], inner: T.type_parameter(:ErrType)).returns(Result::Err[T.type_parameter(:OkType), T.type_parameter(:ErrType)]) }
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Mangrove
5
- VERSION = "0.21.1"
5
+ VERSION = "0.21.2"
6
6
  end
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `io-console` gem.
5
+ # Please instead update this file by running `bin/tapioca gem io-console`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
@@ -0,0 +1,342 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `irb` gem.
5
+ # Please instead update this file by running `bin/tapioca gem irb`.
6
+
7
+ # An output formatter used internally by the lexer.
8
+ #
9
+ # source://irb//lib/irb/notifier.rb#11
10
+ module IRB::Notifier
11
+ private
12
+
13
+ # Define a new Notifier output source, returning a new CompositeNotifier
14
+ # with the given +prefix+ and +output_method+.
15
+ #
16
+ # The optional +prefix+ will be appended to all objects being inspected
17
+ # during output, using the given +output_method+ as the output source. If
18
+ # no +output_method+ is given, StdioOutputMethod will be used, and all
19
+ # expressions will be sent directly to STDOUT without any additional
20
+ # formatting.
21
+ #
22
+ # source://irb//lib/irb/notifier.rb#31
23
+ def def_notifier(prefix = T.unsafe(nil), output_method = T.unsafe(nil)); end
24
+
25
+ class << self
26
+ # Define a new Notifier output source, returning a new CompositeNotifier
27
+ # with the given +prefix+ and +output_method+.
28
+ #
29
+ # The optional +prefix+ will be appended to all objects being inspected
30
+ # during output, using the given +output_method+ as the output source. If
31
+ # no +output_method+ is given, StdioOutputMethod will be used, and all
32
+ # expressions will be sent directly to STDOUT without any additional
33
+ # formatting.
34
+ #
35
+ # source://irb//lib/irb/notifier.rb#31
36
+ def def_notifier(prefix = T.unsafe(nil), output_method = T.unsafe(nil)); end
37
+ end
38
+ end
39
+
40
+ # An abstract class, or superclass, for CompositeNotifier and
41
+ # LeveledNotifier to inherit. It provides several wrapper methods for the
42
+ # OutputMethod object used by the Notifier.
43
+ #
44
+ # source://irb//lib/irb/notifier.rb#39
45
+ class IRB::Notifier::AbstractNotifier
46
+ # Creates a new Notifier object
47
+ #
48
+ # @return [AbstractNotifier] a new instance of AbstractNotifier
49
+ #
50
+ # source://irb//lib/irb/notifier.rb#41
51
+ def initialize(prefix, base_notifier); end
52
+
53
+ # Execute the given block if notifications are enabled.
54
+ #
55
+ # @yield [@base_notifier]
56
+ #
57
+ # source://irb//lib/irb/notifier.rb#99
58
+ def exec_if; end
59
+
60
+ # A wrapper method used to determine whether notifications are enabled.
61
+ #
62
+ # Defaults to +true+.
63
+ #
64
+ # @return [Boolean]
65
+ #
66
+ # source://irb//lib/irb/notifier.rb#53
67
+ def notify?; end
68
+
69
+ # Same as #ppx, except it uses the #prefix given during object
70
+ # initialization.
71
+ # See OutputMethod#ppx for more detail.
72
+ #
73
+ # source://irb//lib/irb/notifier.rb#82
74
+ def pp(*objs); end
75
+
76
+ # Same as #pp, except it concatenates the given +prefix+ with the #prefix
77
+ # given during object initialization.
78
+ #
79
+ # See OutputMethod#ppx for more detail.
80
+ #
81
+ # source://irb//lib/irb/notifier.rb#92
82
+ def ppx(prefix, *objs); end
83
+
84
+ # The +prefix+ for this Notifier, which is appended to all objects being
85
+ # inspected during output.
86
+ #
87
+ # source://irb//lib/irb/notifier.rb#48
88
+ def prefix; end
89
+
90
+ # See OutputMethod#print for more detail.
91
+ #
92
+ # source://irb//lib/irb/notifier.rb#58
93
+ def print(*opts); end
94
+
95
+ # See OutputMethod#printf for more detail.
96
+ #
97
+ # source://irb//lib/irb/notifier.rb#68
98
+ def printf(format, *opts); end
99
+
100
+ # See OutputMethod#printn for more detail.
101
+ #
102
+ # source://irb//lib/irb/notifier.rb#63
103
+ def printn(*opts); end
104
+
105
+ # See OutputMethod#puts for more detail.
106
+ #
107
+ # source://irb//lib/irb/notifier.rb#73
108
+ def puts(*objs); end
109
+ end
110
+
111
+ # A class that can be used to create a group of notifier objects with the
112
+ # intent of representing a leveled notification system for irb.
113
+ #
114
+ # This class will allow you to generate other notifiers, and assign them
115
+ # the appropriate level for output.
116
+ #
117
+ # The Notifier class provides a class-method Notifier.def_notifier to
118
+ # create a new composite notifier. Using the first composite notifier
119
+ # object you create, sibling notifiers can be initialized with
120
+ # #def_notifier.
121
+ #
122
+ # source://irb//lib/irb/notifier.rb#116
123
+ class IRB::Notifier::CompositeNotifier < ::IRB::Notifier::AbstractNotifier
124
+ # Create a new composite notifier object with the given +prefix+, and
125
+ # +base_notifier+ to use for output.
126
+ #
127
+ # @return [CompositeNotifier] a new instance of CompositeNotifier
128
+ #
129
+ # source://irb//lib/irb/notifier.rb#117
130
+ def initialize(prefix, base_notifier); end
131
+
132
+ # Creates a new LeveledNotifier in the composite #notifiers group.
133
+ #
134
+ # The given +prefix+ will be assigned to the notifier, and +level+ will
135
+ # be used as the index of the #notifiers Array.
136
+ #
137
+ # This method returns the newly created instance.
138
+ #
139
+ # source://irb//lib/irb/notifier.rb#133
140
+ def def_notifier(level, prefix = T.unsafe(nil)); end
141
+
142
+ # Returns the leveled notifier for this object
143
+ #
144
+ # source://irb//lib/irb/notifier.rb#140
145
+ def level; end
146
+
147
+ # Sets the leveled notifier for this object.
148
+ #
149
+ # When the given +value+ is an instance of AbstractNotifier,
150
+ # #level_notifier is set to the given object.
151
+ #
152
+ # When an Integer is given, #level_notifier is set to the notifier at the
153
+ # index +value+ in the #notifiers Array.
154
+ #
155
+ # If no notifier exists at the index +value+ in the #notifiers Array, an
156
+ # ErrUndefinedNotifier exception is raised.
157
+ #
158
+ # An ErrUnrecognizedLevel exception is raised if the given +value+ is not
159
+ # found in the existing #notifiers Array, or an instance of
160
+ # AbstractNotifier
161
+ #
162
+ # source://irb//lib/irb/notifier.rb#157
163
+ def level=(value); end
164
+
165
+ # Returns the leveled notifier for this object
166
+ #
167
+ # source://irb//lib/irb/notifier.rb#140
168
+ def level_notifier; end
169
+
170
+ # Sets the leveled notifier for this object.
171
+ #
172
+ # When the given +value+ is an instance of AbstractNotifier,
173
+ # #level_notifier is set to the given object.
174
+ #
175
+ # When an Integer is given, #level_notifier is set to the notifier at the
176
+ # index +value+ in the #notifiers Array.
177
+ #
178
+ # If no notifier exists at the index +value+ in the #notifiers Array, an
179
+ # ErrUndefinedNotifier exception is raised.
180
+ #
181
+ # An ErrUnrecognizedLevel exception is raised if the given +value+ is not
182
+ # found in the existing #notifiers Array, or an instance of
183
+ # AbstractNotifier
184
+ #
185
+ # source://irb//lib/irb/notifier.rb#157
186
+ def level_notifier=(value); end
187
+
188
+ # List of notifiers in the group
189
+ #
190
+ # source://irb//lib/irb/notifier.rb#125
191
+ def notifiers; end
192
+ end
193
+
194
+ # source://irb//lib/irb/notifier.rb#12
195
+ class IRB::Notifier::ErrUndefinedNotifier < ::StandardError
196
+ # @return [ErrUndefinedNotifier] a new instance of ErrUndefinedNotifier
197
+ #
198
+ # source://irb//lib/irb/notifier.rb#13
199
+ def initialize(val); end
200
+ end
201
+
202
+ # source://irb//lib/irb/notifier.rb#17
203
+ class IRB::Notifier::ErrUnrecognizedLevel < ::StandardError
204
+ # @return [ErrUnrecognizedLevel] a new instance of ErrUnrecognizedLevel
205
+ #
206
+ # source://irb//lib/irb/notifier.rb#18
207
+ def initialize(val); end
208
+ end
209
+
210
+ # A leveled notifier is comparable to the composite group from
211
+ # CompositeNotifier#notifiers.
212
+ #
213
+ # source://irb//lib/irb/notifier.rb#175
214
+ class IRB::Notifier::LeveledNotifier < ::IRB::Notifier::AbstractNotifier
215
+ include ::Comparable
216
+
217
+ # Create a new leveled notifier with the given +base+, and +prefix+ to
218
+ # send to AbstractNotifier.new
219
+ #
220
+ # The given +level+ is used to compare other leveled notifiers in the
221
+ # CompositeNotifier group to determine whether or not to output
222
+ # notifications.
223
+ #
224
+ # @return [LeveledNotifier] a new instance of LeveledNotifier
225
+ #
226
+ # source://irb//lib/irb/notifier.rb#184
227
+ def initialize(base, level, prefix); end
228
+
229
+ # Compares the level of this notifier object with the given +other+
230
+ # notifier.
231
+ #
232
+ # See the Comparable module for more information.
233
+ #
234
+ # source://irb//lib/irb/notifier.rb#197
235
+ def <=>(other); end
236
+
237
+ # The current level of this notifier object
238
+ #
239
+ # source://irb//lib/irb/notifier.rb#191
240
+ def level; end
241
+
242
+ # Whether to output messages to the output method, depending on the level
243
+ # of this notifier object.
244
+ #
245
+ # @return [Boolean]
246
+ #
247
+ # source://irb//lib/irb/notifier.rb#203
248
+ def notify?; end
249
+ end
250
+
251
+ # NoMsgNotifier is a LeveledNotifier that's used as the default notifier
252
+ # when creating a new CompositeNotifier.
253
+ #
254
+ # This notifier is used as the +zero+ index, or level +0+, for
255
+ # CompositeNotifier#notifiers, and will not output messages of any sort.
256
+ #
257
+ # source://irb//lib/irb/notifier.rb#214
258
+ class IRB::Notifier::NoMsgNotifier < ::IRB::Notifier::LeveledNotifier
259
+ # Creates a new notifier that should not be used to output messages.
260
+ #
261
+ # @return [NoMsgNotifier] a new instance of NoMsgNotifier
262
+ #
263
+ # source://irb//lib/irb/notifier.rb#215
264
+ def initialize; end
265
+
266
+ # Ensures notifications are ignored, see AbstractNotifier#notify? for
267
+ # more information.
268
+ #
269
+ # @return [Boolean]
270
+ #
271
+ # source://irb//lib/irb/notifier.rb#223
272
+ def notify?; end
273
+ end
274
+
275
+ # An abstract output class for IO in irb. This is mainly used internally by
276
+ # IRB::Notifier. You can define your own output method to use with Irb.new,
277
+ # or Context.new
278
+ #
279
+ # source://irb//lib/irb/output-method.rb#11
280
+ class IRB::OutputMethod
281
+ # Returns an array of the given +format+ and +opts+ to be used by
282
+ # Kernel#sprintf, if there was a successful Regexp match in the given
283
+ # +format+ from #printf
284
+ #
285
+ # %
286
+ # <flag> [#0- +]
287
+ # <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
288
+ # <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
289
+ # #<length modifier>(hh|h|l|ll|L|q|j|z|t)
290
+ # <conversion specifier>[diouxXeEfgGcsb%]
291
+ #
292
+ # source://irb//lib/irb/output-method.rb#48
293
+ def parse_printf_format(format, opts); end
294
+
295
+ # Prints the given +objs+ calling Object#inspect on each.
296
+ #
297
+ # See #puts for more detail.
298
+ #
299
+ # source://irb//lib/irb/output-method.rb#64
300
+ def pp(*objs); end
301
+
302
+ # Prints the given +objs+ calling Object#inspect on each and appending the
303
+ # given +prefix+.
304
+ #
305
+ # See #puts for more detail.
306
+ #
307
+ # source://irb//lib/irb/output-method.rb#72
308
+ def ppx(prefix, *objs); end
309
+
310
+ # Open this method to implement your own output method, raises a
311
+ # NotImplementedError if you don't define #print in your own class.
312
+ #
313
+ # @raise [NotImplementedError]
314
+ #
315
+ # source://irb//lib/irb/output-method.rb#20
316
+ def print(*opts); end
317
+
318
+ # Extends IO#printf to format the given +opts+ for Kernel#sprintf using
319
+ # #parse_printf_format
320
+ #
321
+ # source://irb//lib/irb/output-method.rb#31
322
+ def printf(format, *opts); end
323
+
324
+ # Prints the given +opts+, with a newline delimiter.
325
+ #
326
+ # source://irb//lib/irb/output-method.rb#25
327
+ def printn(*opts); end
328
+
329
+ # Calls #print on each element in the given +objs+, followed by a newline
330
+ # character.
331
+ #
332
+ # source://irb//lib/irb/output-method.rb#54
333
+ def puts(*objs); end
334
+ end
335
+
336
+ # source://irb//lib/irb/output-method.rb#12
337
+ class IRB::OutputMethod::NotImplementedError < ::StandardError
338
+ # @return [NotImplementedError] a new instance of NotImplementedError
339
+ #
340
+ # source://irb//lib/irb/output-method.rb#13
341
+ def initialize(val); end
342
+ end