mangrove 0.17.0 → 0.18.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.
- checksums.yaml +4 -4
- data/docs/Mangrove/ControlFlow/ControlSignal.html +2 -2
- data/docs/Mangrove/ControlFlow.html +2 -2
- data/docs/Mangrove/Option/ControlSignal.html +2 -2
- data/docs/Mangrove/Option/None.html +2 -2
- data/docs/Mangrove/Option/Some.html +2 -2
- data/docs/Mangrove/Option.html +2 -2
- data/docs/Mangrove/Result/ControlSignal.html +2 -2
- data/docs/Mangrove/Result/Err.html +253 -90
- data/docs/Mangrove/Result/Ok.html +249 -86
- data/docs/Mangrove/Result.html +217 -54
- data/docs/Mangrove.html +3 -3
- data/docs/_index.html +8 -8
- data/docs/file.README.html +2 -2
- data/docs/index.html +2 -2
- data/docs/method_list.html +186 -138
- data/docs/top-level-namespace.html +2 -2
- data/lib/mangrove/result.rb +26 -0
- data/lib/mangrove/version.rb +1 -1
- metadata +7 -9
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
- data/sorbet/rbi/gems/unparser@0.6.9.rbi +0 -8
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on Wed Nov
|
103
|
+
Generated on Wed Nov 15 22:12:58 2023 by
|
104
104
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.34 (ruby-3.
|
105
|
+
0.9.34 (ruby-3.1.2).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
data/lib/mangrove/result.rb
CHANGED
@@ -30,6 +30,12 @@ module Mangrove
|
|
30
30
|
sig { abstract.returns(OkType) }
|
31
31
|
def unwrap!; end
|
32
32
|
|
33
|
+
sig { abstract.params(exception: Exception).returns(OkType) }
|
34
|
+
def unwrap_or_raise!(exception); end
|
35
|
+
|
36
|
+
sig { abstract.returns(OkType) }
|
37
|
+
def unwrap_or_raise_inner!; end
|
38
|
+
|
33
39
|
sig { abstract.params(message: String).returns(OkType) }
|
34
40
|
def expect!(message); end
|
35
41
|
|
@@ -151,6 +157,16 @@ module Mangrove
|
|
151
157
|
@inner
|
152
158
|
end
|
153
159
|
|
160
|
+
sig { override.params(_exception: Exception).returns(OkType) }
|
161
|
+
def unwrap_or_raise!(_exception)
|
162
|
+
@inner
|
163
|
+
end
|
164
|
+
|
165
|
+
sig { override.returns(OkType) }
|
166
|
+
def unwrap_or_raise_inner!
|
167
|
+
@inner
|
168
|
+
end
|
169
|
+
|
154
170
|
sig { override.params(_message: String).returns(OkType) }
|
155
171
|
def expect!(_message)
|
156
172
|
@inner
|
@@ -273,6 +289,16 @@ module Mangrove
|
|
273
289
|
raise Result::ControlSignal, @inner
|
274
290
|
end
|
275
291
|
|
292
|
+
sig { override.params(exception: Exception).returns(OkType) }
|
293
|
+
def unwrap_or_raise!(exception)
|
294
|
+
raise exception
|
295
|
+
end
|
296
|
+
|
297
|
+
sig { override.returns(OkType) }
|
298
|
+
def unwrap_or_raise_inner!
|
299
|
+
raise T.unsafe(@inner)
|
300
|
+
end
|
301
|
+
|
276
302
|
sig { override.params(message: String).returns(OkType) }
|
277
303
|
def expect!(message)
|
278
304
|
raise Result::ControlSignal, message
|
data/lib/mangrove/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangrove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuma Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.5.11128
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.5.11128
|
27
27
|
description: Type Utility for Ruby.
|
28
28
|
email:
|
29
29
|
- kazzix14@gmail.com
|
@@ -81,7 +81,6 @@ files:
|
|
81
81
|
- sorbet/rbi/gems/erubi@1.12.0.rbi
|
82
82
|
- sorbet/rbi/gems/json@2.6.3.rbi
|
83
83
|
- sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi
|
84
|
-
- sorbet/rbi/gems/method_source@1.0.0.rbi
|
85
84
|
- sorbet/rbi/gems/netrc@0.11.0.rbi
|
86
85
|
- sorbet/rbi/gems/ordinare@0.4.0.rbi
|
87
86
|
- sorbet/rbi/gems/parallel@1.23.0.rbi
|
@@ -114,7 +113,6 @@ files:
|
|
114
113
|
- sorbet/rbi/gems/tapioca@0.11.9.rbi
|
115
114
|
- sorbet/rbi/gems/thor@1.3.0.rbi
|
116
115
|
- sorbet/rbi/gems/unicode-display_width@2.5.0.rbi
|
117
|
-
- sorbet/rbi/gems/unparser@0.6.9.rbi
|
118
116
|
- sorbet/rbi/gems/yard-sorbet@0.8.1.rbi
|
119
117
|
- sorbet/rbi/gems/yard@0.9.34.rbi
|
120
118
|
- sorbet/rbi/gems/yarp@0.13.0.rbi
|
@@ -146,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
144
|
- !ruby/object:Gem::Version
|
147
145
|
version: '0'
|
148
146
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.3.7
|
150
148
|
signing_key:
|
151
149
|
specification_version: 4
|
152
150
|
summary: Type Utility for Ruby.
|
@@ -1,272 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
# DO NOT EDIT MANUALLY
|
4
|
-
# This is an autogenerated file for types exported from the `method_source` gem.
|
5
|
-
# Please instead update this file by running `bin/tapioca gem method_source`.
|
6
|
-
|
7
|
-
# source://method_source//lib/method_source.rb#127
|
8
|
-
class Method
|
9
|
-
include ::MethodSource::SourceLocation::MethodExtensions
|
10
|
-
include ::MethodSource::MethodExtensions
|
11
|
-
end
|
12
|
-
|
13
|
-
# source://method_source//lib/method_source/version.rb#1
|
14
|
-
module MethodSource
|
15
|
-
extend ::MethodSource::CodeHelpers
|
16
|
-
|
17
|
-
class << self
|
18
|
-
# Helper method responsible for opening source file and buffering up
|
19
|
-
# the comments for a specified method. Defined here to avoid polluting
|
20
|
-
# `Method` class.
|
21
|
-
#
|
22
|
-
# @param source_location [Array] The array returned by Method#source_location
|
23
|
-
# @param method_name [String]
|
24
|
-
# @raise [SourceNotFoundError]
|
25
|
-
# @return [String] The comments up to the point of the method.
|
26
|
-
#
|
27
|
-
# source://method_source//lib/method_source.rb#38
|
28
|
-
def comment_helper(source_location, name = T.unsafe(nil)); end
|
29
|
-
|
30
|
-
# @deprecated — use MethodSource::CodeHelpers#expression_at
|
31
|
-
#
|
32
|
-
# source://method_source//lib/method_source.rb#66
|
33
|
-
def extract_code(source_location); end
|
34
|
-
|
35
|
-
# Load a memoized copy of the lines in a file.
|
36
|
-
#
|
37
|
-
# @param file_name [String]
|
38
|
-
# @param method_name [String]
|
39
|
-
# @raise [SourceNotFoundError]
|
40
|
-
# @return [Array<String>] the contents of the file
|
41
|
-
#
|
42
|
-
# source://method_source//lib/method_source.rb#51
|
43
|
-
def lines_for(file_name, name = T.unsafe(nil)); end
|
44
|
-
|
45
|
-
# Helper method responsible for extracting method body.
|
46
|
-
# Defined here to avoid polluting `Method` class.
|
47
|
-
#
|
48
|
-
# @param source_location [Array] The array returned by Method#source_location
|
49
|
-
# @param method_name [String]
|
50
|
-
# @return [String] The method body
|
51
|
-
#
|
52
|
-
# source://method_source//lib/method_source.rb#23
|
53
|
-
def source_helper(source_location, name = T.unsafe(nil)); end
|
54
|
-
|
55
|
-
# @deprecated — use MethodSource::CodeHelpers#complete_expression?
|
56
|
-
# @return [Boolean]
|
57
|
-
#
|
58
|
-
# source://method_source//lib/method_source.rb#59
|
59
|
-
def valid_expression?(str); end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# source://method_source//lib/method_source/code_helpers.rb#3
|
64
|
-
module MethodSource::CodeHelpers
|
65
|
-
# Retrieve the comment describing the expression on the given line of the given file.
|
66
|
-
#
|
67
|
-
# This is useful to get module or method documentation.
|
68
|
-
#
|
69
|
-
# @param file [Array<String>, File, String] The file to parse, either as a File or as
|
70
|
-
# a String or an Array of lines.
|
71
|
-
# @param line_number [Integer] The line number at which to look.
|
72
|
-
# NOTE: The first line in a file is line 1!
|
73
|
-
# @return [String] The comment
|
74
|
-
#
|
75
|
-
# source://method_source//lib/method_source/code_helpers.rb#52
|
76
|
-
def comment_describing(file, line_number); end
|
77
|
-
|
78
|
-
# Determine if a string of code is a complete Ruby expression.
|
79
|
-
#
|
80
|
-
# @example
|
81
|
-
# complete_expression?("class Hello") #=> false
|
82
|
-
# complete_expression?("class Hello; end") #=> true
|
83
|
-
# complete_expression?("class 123") #=> SyntaxError: unexpected tINTEGER
|
84
|
-
# @param code [String] The code to validate.
|
85
|
-
# @raise [SyntaxError] Any SyntaxError that does not represent incompleteness.
|
86
|
-
# @return [Boolean] Whether or not the code is a complete Ruby expression.
|
87
|
-
#
|
88
|
-
# source://method_source//lib/method_source/code_helpers.rb#66
|
89
|
-
def complete_expression?(str); end
|
90
|
-
|
91
|
-
# Retrieve the first expression starting on the given line of the given file.
|
92
|
-
#
|
93
|
-
# This is useful to get module or method source code.
|
94
|
-
#
|
95
|
-
# line 1!
|
96
|
-
#
|
97
|
-
# @option options
|
98
|
-
# @option options
|
99
|
-
# @param file [Array<String>, File, String] The file to parse, either as a File or as
|
100
|
-
# @param line_number [Integer] The line number at which to look.
|
101
|
-
# NOTE: The first line in a file is
|
102
|
-
# @param options [Hash] The optional configuration parameters.
|
103
|
-
# @raise [SyntaxError] If the first complete expression can't be identified
|
104
|
-
# @return [String] The first complete expression
|
105
|
-
#
|
106
|
-
# source://method_source//lib/method_source/code_helpers.rb#20
|
107
|
-
def expression_at(file, line_number, options = T.unsafe(nil)); end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
# Get the first expression from the input.
|
112
|
-
#
|
113
|
-
# @param lines [Array<String>]
|
114
|
-
# @param consume [Integer] A number of lines to automatically
|
115
|
-
# consume (add to the expression buffer) without checking for validity.
|
116
|
-
# @raise [SyntaxError]
|
117
|
-
# @return [String] a valid ruby expression
|
118
|
-
# @yield a clean-up function to run before checking for complete_expression
|
119
|
-
#
|
120
|
-
# source://method_source//lib/method_source/code_helpers.rb#92
|
121
|
-
def extract_first_expression(lines, consume = T.unsafe(nil), &block); end
|
122
|
-
|
123
|
-
# Get the last comment from the input.
|
124
|
-
#
|
125
|
-
# @param lines [Array<String>]
|
126
|
-
# @return [String]
|
127
|
-
#
|
128
|
-
# source://method_source//lib/method_source/code_helpers.rb#106
|
129
|
-
def extract_last_comment(lines); end
|
130
|
-
end
|
131
|
-
|
132
|
-
# An exception matcher that matches only subsets of SyntaxErrors that can be
|
133
|
-
# fixed by adding more input to the buffer.
|
134
|
-
#
|
135
|
-
# source://method_source//lib/method_source/code_helpers.rb#124
|
136
|
-
module MethodSource::CodeHelpers::IncompleteExpression
|
137
|
-
class << self
|
138
|
-
# source://method_source//lib/method_source/code_helpers.rb#137
|
139
|
-
def ===(ex); end
|
140
|
-
|
141
|
-
# @return [Boolean]
|
142
|
-
#
|
143
|
-
# source://method_source//lib/method_source/code_helpers.rb#149
|
144
|
-
def rbx?; end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# source://method_source//lib/method_source/code_helpers.rb#125
|
149
|
-
MethodSource::CodeHelpers::IncompleteExpression::GENERIC_REGEXPS = T.let(T.unsafe(nil), Array)
|
150
|
-
|
151
|
-
# source://method_source//lib/method_source/code_helpers.rb#133
|
152
|
-
MethodSource::CodeHelpers::IncompleteExpression::RBX_ONLY_REGEXPS = T.let(T.unsafe(nil), Array)
|
153
|
-
|
154
|
-
# This module is to be included by `Method` and `UnboundMethod` and
|
155
|
-
# provides the `#source` functionality
|
156
|
-
#
|
157
|
-
# source://method_source//lib/method_source.rb#72
|
158
|
-
module MethodSource::MethodExtensions
|
159
|
-
# Return the comments associated with the method as a string.
|
160
|
-
#
|
161
|
-
# @example
|
162
|
-
# Set.instance_method(:clear).comment.display
|
163
|
-
# =>
|
164
|
-
# # Removes all elements and returns self.
|
165
|
-
# @raise SourceNotFoundException
|
166
|
-
# @return [String] The method's comments as a string
|
167
|
-
#
|
168
|
-
# source://method_source//lib/method_source.rb#121
|
169
|
-
def comment; end
|
170
|
-
|
171
|
-
# Return the sourcecode for the method as a string
|
172
|
-
#
|
173
|
-
# @example
|
174
|
-
# Set.instance_method(:clear).source.display
|
175
|
-
# =>
|
176
|
-
# def clear
|
177
|
-
# @hash.clear
|
178
|
-
# self
|
179
|
-
# end
|
180
|
-
# @raise SourceNotFoundException
|
181
|
-
# @return [String] The method sourcecode as a string
|
182
|
-
#
|
183
|
-
# source://method_source//lib/method_source.rb#109
|
184
|
-
def source; end
|
185
|
-
|
186
|
-
class << self
|
187
|
-
# We use the included hook to patch Method#source on rubinius.
|
188
|
-
# We need to use the included hook as Rubinius defines a `source`
|
189
|
-
# on Method so including a module will have no effect (as it's
|
190
|
-
# higher up the MRO).
|
191
|
-
#
|
192
|
-
# @param klass [Class] The class that includes the module.
|
193
|
-
#
|
194
|
-
# source://method_source//lib/method_source.rb#79
|
195
|
-
def included(klass); end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
# source://method_source//lib/method_source/source_location.rb#2
|
200
|
-
module MethodSource::ReeSourceLocation
|
201
|
-
# Ruby enterprise edition provides all the information that's
|
202
|
-
# needed, in a slightly different way.
|
203
|
-
#
|
204
|
-
# source://method_source//lib/method_source/source_location.rb#5
|
205
|
-
def source_location; end
|
206
|
-
end
|
207
|
-
|
208
|
-
# source://method_source//lib/method_source/source_location.rb#10
|
209
|
-
module MethodSource::SourceLocation; end
|
210
|
-
|
211
|
-
# source://method_source//lib/method_source/source_location.rb#11
|
212
|
-
module MethodSource::SourceLocation::MethodExtensions
|
213
|
-
# Return the source location of a method for Ruby 1.8.
|
214
|
-
#
|
215
|
-
# @return [Array] A two element array. First element is the
|
216
|
-
# file, second element is the line in the file where the
|
217
|
-
# method definition is found.
|
218
|
-
#
|
219
|
-
# source://method_source//lib/method_source/source_location.rb#40
|
220
|
-
def source_location; end
|
221
|
-
|
222
|
-
private
|
223
|
-
|
224
|
-
# source://method_source//lib/method_source/source_location.rb#26
|
225
|
-
def trace_func(event, file, line, id, binding, classname); end
|
226
|
-
end
|
227
|
-
|
228
|
-
# source://method_source//lib/method_source/source_location.rb#54
|
229
|
-
module MethodSource::SourceLocation::ProcExtensions
|
230
|
-
# Return the source location for a Proc (in implementations
|
231
|
-
# without Proc#source_location)
|
232
|
-
#
|
233
|
-
# @return [Array] A two element array. First element is the
|
234
|
-
# file, second element is the line in the file where the
|
235
|
-
# proc definition is found.
|
236
|
-
#
|
237
|
-
# source://method_source//lib/method_source/source_location.rb#74
|
238
|
-
def source_location; end
|
239
|
-
end
|
240
|
-
|
241
|
-
# source://method_source//lib/method_source/source_location.rb#81
|
242
|
-
module MethodSource::SourceLocation::UnboundMethodExtensions
|
243
|
-
# Return the source location of an instance method for Ruby 1.8.
|
244
|
-
#
|
245
|
-
# @return [Array] A two element array. First element is the
|
246
|
-
# file, second element is the line in the file where the
|
247
|
-
# method definition is found.
|
248
|
-
#
|
249
|
-
# source://method_source//lib/method_source/source_location.rb#101
|
250
|
-
def source_location; end
|
251
|
-
end
|
252
|
-
|
253
|
-
# An Exception to mark errors that were raised trying to find the source from
|
254
|
-
# a given source_location.
|
255
|
-
#
|
256
|
-
# source://method_source//lib/method_source.rb#16
|
257
|
-
class MethodSource::SourceNotFoundError < ::StandardError; end
|
258
|
-
|
259
|
-
# source://method_source//lib/method_source/version.rb#2
|
260
|
-
MethodSource::VERSION = T.let(T.unsafe(nil), String)
|
261
|
-
|
262
|
-
# source://method_source//lib/method_source.rb#137
|
263
|
-
class Proc
|
264
|
-
include ::MethodSource::SourceLocation::ProcExtensions
|
265
|
-
include ::MethodSource::MethodExtensions
|
266
|
-
end
|
267
|
-
|
268
|
-
# source://method_source//lib/method_source.rb#132
|
269
|
-
class UnboundMethod
|
270
|
-
include ::MethodSource::SourceLocation::UnboundMethodExtensions
|
271
|
-
include ::MethodSource::MethodExtensions
|
272
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
# DO NOT EDIT MANUALLY
|
4
|
-
# This is an autogenerated file for types exported from the `unparser` gem.
|
5
|
-
# Please instead update this file by running `bin/tapioca gem unparser`.
|
6
|
-
|
7
|
-
# THIS IS AN EMPTY RBI FILE.
|
8
|
-
# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
|