sorbet-result 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.standard.yml +6 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -4
- data/Gemfile.lock +75 -55
- data/README.md +23 -0
- data/Rakefile +3 -5
- data/lib/minitest/result_assertions.rb +48 -0
- data/lib/sorbet-result.rb +1 -5
- data/lib/typed/result.rb +169 -7
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.7.1.rbi} +80 -60
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +239 -0
- data/sorbet/rbi/gems/{minitest@5.18.1.rbi → minitest@5.22.2.rbi} +285 -241
- data/sorbet/rbi/gems/{parallel@1.23.0.rbi → parallel@1.24.0.rbi} +8 -1
- data/sorbet/rbi/gems/{parser@3.2.2.3.rbi → parser@3.3.0.5.rbi} +438 -2219
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1731 -0
- data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.7.3.rbi} +35 -39
- data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +68 -65
- data/sorbet/rbi/gems/{rbi@0.0.16.rbi → rbi@0.1.9.rbi} +712 -714
- data/sorbet/rbi/gems/{regexp_parser@2.8.1.rbi → regexp_parser@2.9.0.rbi} +187 -165
- data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.2.6.rbi} +116 -52
- data/sorbet/rbi/gems/{rubocop-ast@1.29.0.rbi → rubocop-ast@1.30.0.rbi} +77 -77
- data/sorbet/rbi/gems/rubocop-performance@1.20.2.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.7.rbi +8 -0
- data/sorbet/rbi/gems/{rubocop@1.52.1.rbi → rubocop@1.60.2.rbi} +3593 -1700
- data/sorbet/rbi/gems/{spoom@1.2.1.rbi → spoom@1.2.4.rbi} +1378 -104
- data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +8 -0
- data/sorbet/rbi/gems/standard-performance@1.3.1.rbi +8 -0
- data/sorbet/rbi/gems/standard-sorbet@0.0.2.rbi +52 -0
- data/sorbet/rbi/gems/standard@1.34.0.rbi +850 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23133 -0
- data/sorbet/rbi/gems/{tapioca@0.11.6.rbi → tapioca@0.12.0.rbi} +776 -574
- data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.3.0.rbi} +775 -395
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +1 -1
- data/sorbet/rbi/gems/yard@0.9.34.rbi +2 -2
- data/sorbet/tapioca/config.yml +3 -12
- data/sorbet/tapioca/require.rb +0 -1
- metadata +41 -34
- data/.rubocop.yml +0 -33
- data/lib/typed/failure.rb +0 -81
- data/lib/typed/success.rb +0 -80
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
- data/sorbet/rbi/gems/irb@1.7.0.rbi +0 -342
- data/sorbet/rbi/gems/rubocop-minitest@0.31.0.rbi +0 -2528
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -328
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.0.rbi +0 -1043
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +0 -4525
- data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +0 -986
- /data/sorbet/rbi/gems/{io-console@0.6.0.rbi → io-console@0.7.2.rbi} +0 -0
- /data/sorbet/rbi/gems/{reline@0.3.5.rbi → reline@0.4.2.rbi} +0 -0
- /data/sorbet/rbi/gems/{unicode-display_width@2.4.2.rbi → unicode-display_width@2.5.0.rbi} +0 -0
@@ -381,7 +381,7 @@ class YARDSorbet::TStructProp < ::T::Struct
|
|
381
381
|
const :types, T::Array[::String]
|
382
382
|
|
383
383
|
class << self
|
384
|
-
# source://sorbet-runtime/0.5.
|
384
|
+
# source://sorbet-runtime/0.5.11262/lib/types/struct.rb#13
|
385
385
|
def inherited(s); end
|
386
386
|
end
|
387
387
|
end
|
@@ -7635,7 +7635,7 @@ class YARD::Logger < ::Logger
|
|
7635
7635
|
# source://yard//lib/yard/logging.rb#201
|
7636
7636
|
def format_log(sev, _time, _prog, msg); end
|
7637
7637
|
|
7638
|
-
# source://logger/1.
|
7638
|
+
# source://logger/1.6.0/logger.rb#684
|
7639
7639
|
def print_no_newline(msg); end
|
7640
7640
|
|
7641
7641
|
class << self
|
@@ -9972,7 +9972,7 @@ end
|
|
9972
9972
|
|
9973
9973
|
# source://yard//lib/yard/parser/ruby/ast_node.rb#479
|
9974
9974
|
class YARD::Parser::Ruby::MethodDefinitionNode < ::YARD::Parser::Ruby::AstNode
|
9975
|
-
def block(
|
9975
|
+
def block(n = T.unsafe(nil)); end
|
9976
9976
|
|
9977
9977
|
# @return [Boolean]
|
9978
9978
|
#
|
data/sorbet/tapioca/config.yml
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
gem:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# - gem_name
|
6
|
-
# doc: true
|
7
|
-
# workers: 5
|
8
|
-
dsl:
|
9
|
-
# Add your `dsl` command parameters here:
|
10
|
-
#
|
11
|
-
# exclude:
|
12
|
-
# - SomeGeneratorName
|
13
|
-
# workers: 5
|
2
|
+
exclude:
|
3
|
+
- rdoc
|
4
|
+
workers: 5
|
data/sorbet/tapioca/require.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-result
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max VelDink
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
33
|
+
version: '5.22'
|
34
|
+
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.22'
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- maxveldink@gmail.com
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- ".rubocop.yml"
|
49
48
|
- ".ruby-version"
|
49
|
+
- ".standard.yml"
|
50
50
|
- ".tool-versions"
|
51
51
|
- CHANGELOG.md
|
52
52
|
- CODE_OF_CONDUCT.md
|
@@ -55,44 +55,51 @@ files:
|
|
55
55
|
- LICENSE.txt
|
56
56
|
- README.md
|
57
57
|
- Rakefile
|
58
|
+
- lib/minitest/result_assertions.rb
|
58
59
|
- lib/sorbet-result.rb
|
59
|
-
- lib/typed/failure.rb
|
60
60
|
- lib/typed/no_error_on_success_error.rb
|
61
61
|
- lib/typed/no_payload_on_failure_error.rb
|
62
62
|
- lib/typed/result.rb
|
63
|
-
- lib/typed/success.rb
|
64
63
|
- sorbet/config
|
65
64
|
- sorbet/rbi/annotations/rainbow.rbi
|
65
|
+
- sorbet/rbi/gems/.gitattributes
|
66
66
|
- sorbet/rbi/gems/ast@2.4.2.rbi
|
67
|
-
- sorbet/rbi/gems/
|
68
|
-
- sorbet/rbi/gems/io-console@0.
|
69
|
-
- sorbet/rbi/gems/
|
70
|
-
- sorbet/rbi/gems/
|
71
|
-
- sorbet/rbi/gems/
|
67
|
+
- sorbet/rbi/gems/erubi@1.12.0.rbi
|
68
|
+
- sorbet/rbi/gems/io-console@0.7.2.rbi
|
69
|
+
- sorbet/rbi/gems/json@2.7.1.rbi
|
70
|
+
- sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi
|
71
|
+
- sorbet/rbi/gems/lint_roller@1.1.0.rbi
|
72
|
+
- sorbet/rbi/gems/minitest@5.22.2.rbi
|
72
73
|
- sorbet/rbi/gems/netrc@0.11.0.rbi
|
73
|
-
- sorbet/rbi/gems/parallel@1.
|
74
|
-
- sorbet/rbi/gems/parser@3.
|
75
|
-
- sorbet/rbi/gems/
|
74
|
+
- sorbet/rbi/gems/parallel@1.24.0.rbi
|
75
|
+
- sorbet/rbi/gems/parser@3.3.0.5.rbi
|
76
|
+
- sorbet/rbi/gems/prettier_print@1.2.1.rbi
|
77
|
+
- sorbet/rbi/gems/prism@0.24.0.rbi
|
78
|
+
- sorbet/rbi/gems/psych@5.1.2.rbi
|
79
|
+
- sorbet/rbi/gems/racc@1.7.3.rbi
|
76
80
|
- sorbet/rbi/gems/rainbow@3.1.1.rbi
|
77
|
-
- sorbet/rbi/gems/rake@13.0.
|
78
|
-
- sorbet/rbi/gems/rbi@0.
|
79
|
-
- sorbet/rbi/gems/regexp_parser@2.
|
80
|
-
- sorbet/rbi/gems/reline@0.
|
81
|
-
- sorbet/rbi/gems/rexml@3.2.
|
82
|
-
- sorbet/rbi/gems/rubocop-ast@1.
|
83
|
-
- sorbet/rbi/gems/rubocop-
|
84
|
-
- sorbet/rbi/gems/rubocop-
|
85
|
-
- sorbet/rbi/gems/rubocop
|
86
|
-
- sorbet/rbi/gems/rubocop@1.52.1.rbi
|
81
|
+
- sorbet/rbi/gems/rake@13.1.0.rbi
|
82
|
+
- sorbet/rbi/gems/rbi@0.1.9.rbi
|
83
|
+
- sorbet/rbi/gems/regexp_parser@2.9.0.rbi
|
84
|
+
- sorbet/rbi/gems/reline@0.4.2.rbi
|
85
|
+
- sorbet/rbi/gems/rexml@3.2.6.rbi
|
86
|
+
- sorbet/rbi/gems/rubocop-ast@1.30.0.rbi
|
87
|
+
- sorbet/rbi/gems/rubocop-performance@1.20.2.rbi
|
88
|
+
- sorbet/rbi/gems/rubocop-sorbet@0.7.7.rbi
|
89
|
+
- sorbet/rbi/gems/rubocop@1.60.2.rbi
|
87
90
|
- sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi
|
88
|
-
- sorbet/rbi/gems/spoom@1.2.
|
89
|
-
- sorbet/rbi/gems/
|
90
|
-
- sorbet/rbi/gems/
|
91
|
-
- sorbet/rbi/gems/
|
92
|
-
- sorbet/rbi/gems/
|
91
|
+
- sorbet/rbi/gems/spoom@1.2.4.rbi
|
92
|
+
- sorbet/rbi/gems/standard-custom@1.0.2.rbi
|
93
|
+
- sorbet/rbi/gems/standard-performance@1.3.1.rbi
|
94
|
+
- sorbet/rbi/gems/standard-sorbet@0.0.2.rbi
|
95
|
+
- sorbet/rbi/gems/standard@1.34.0.rbi
|
96
|
+
- sorbet/rbi/gems/stringio@3.1.0.rbi
|
97
|
+
- sorbet/rbi/gems/syntax_tree@6.2.0.rbi
|
98
|
+
- sorbet/rbi/gems/tapioca@0.12.0.rbi
|
99
|
+
- sorbet/rbi/gems/thor@1.3.0.rbi
|
100
|
+
- sorbet/rbi/gems/unicode-display_width@2.5.0.rbi
|
93
101
|
- sorbet/rbi/gems/yard-sorbet@0.8.1.rbi
|
94
102
|
- sorbet/rbi/gems/yard@0.9.34.rbi
|
95
|
-
- sorbet/rbi/gems/zeitwerk@2.6.8.rbi
|
96
103
|
- sorbet/tapioca/config.yml
|
97
104
|
- sorbet/tapioca/require.rb
|
98
105
|
homepage: https://github.com/maxveldink/sorbet-result
|
@@ -119,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
126
|
- !ruby/object:Gem::Version
|
120
127
|
version: '0'
|
121
128
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.5.3
|
123
130
|
signing_key:
|
124
131
|
specification_version: 4
|
125
132
|
summary: Adds T::Result to sorbet-runtime, which is a basic, strongly-typed monad
|
data/.rubocop.yml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
inherit_mode:
|
2
|
-
merge:
|
3
|
-
- Exclude
|
4
|
-
|
5
|
-
require:
|
6
|
-
- rubocop-minitest
|
7
|
-
- rubocop-rake
|
8
|
-
- rubocop-sorbet
|
9
|
-
|
10
|
-
AllCops:
|
11
|
-
NewCops: enable
|
12
|
-
TargetRubyVersion: 3.0
|
13
|
-
Exclude:
|
14
|
-
- sorbet/**/*.rbi
|
15
|
-
|
16
|
-
Style/AccessorGrouping:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/StringLiterals:
|
20
|
-
Enabled: true
|
21
|
-
EnforcedStyle: double_quotes
|
22
|
-
|
23
|
-
Style/StringLiteralsInInterpolation:
|
24
|
-
Enabled: true
|
25
|
-
EnforcedStyle: double_quotes
|
26
|
-
|
27
|
-
Layout/LineLength:
|
28
|
-
Max: 120
|
29
|
-
|
30
|
-
Lint/UselessMethodDefinition:
|
31
|
-
Exclude:
|
32
|
-
- lib/typed/failure.rb
|
33
|
-
- lib/typed/success.rb
|
data/lib/typed/failure.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Typed
|
5
|
-
# Represents a failed result. Contains error information but no payload.
|
6
|
-
class Failure < Result
|
7
|
-
extend T::Sig
|
8
|
-
extend T::Generic
|
9
|
-
|
10
|
-
Payload = type_member { { fixed: T.noreturn } }
|
11
|
-
Error = type_member
|
12
|
-
|
13
|
-
sig { override.returns(Error) }
|
14
|
-
attr_reader :error
|
15
|
-
|
16
|
-
sig do
|
17
|
-
type_parameters(:T)
|
18
|
-
.params(error: T.type_parameter(:T))
|
19
|
-
.returns(Typed::Failure[T.type_parameter(:T)])
|
20
|
-
end
|
21
|
-
def self.new(error)
|
22
|
-
super(error)
|
23
|
-
end
|
24
|
-
|
25
|
-
sig { returns(Typed::Failure[NilClass]) }
|
26
|
-
def self.blank
|
27
|
-
new(nil)
|
28
|
-
end
|
29
|
-
|
30
|
-
sig { params(error: Error).void }
|
31
|
-
def initialize(error)
|
32
|
-
@error = error
|
33
|
-
super()
|
34
|
-
end
|
35
|
-
|
36
|
-
sig { override.returns(T::Boolean) }
|
37
|
-
def success?
|
38
|
-
false
|
39
|
-
end
|
40
|
-
|
41
|
-
sig { override.returns(T::Boolean) }
|
42
|
-
def failure?
|
43
|
-
true
|
44
|
-
end
|
45
|
-
|
46
|
-
sig { override.returns(T.noreturn) }
|
47
|
-
def payload
|
48
|
-
raise NoPayloadOnFailureError
|
49
|
-
end
|
50
|
-
|
51
|
-
sig do
|
52
|
-
override
|
53
|
-
.type_parameters(:U, :T)
|
54
|
-
.params(_block: T.proc.params(arg0: Payload).returns(Result[T.type_parameter(:U), T.type_parameter(:T)]))
|
55
|
-
.returns(Result[T.type_parameter(:U), Error])
|
56
|
-
end
|
57
|
-
def and_then(&_block)
|
58
|
-
self
|
59
|
-
end
|
60
|
-
|
61
|
-
sig do
|
62
|
-
override
|
63
|
-
.params(block: T.proc.params(arg0: Error).void)
|
64
|
-
.returns(T.self_type)
|
65
|
-
end
|
66
|
-
def on_error(&block)
|
67
|
-
block.call(error)
|
68
|
-
self
|
69
|
-
end
|
70
|
-
|
71
|
-
sig do
|
72
|
-
override
|
73
|
-
.type_parameters(:Fallback)
|
74
|
-
.params(value: T.type_parameter(:Fallback))
|
75
|
-
.returns(T.any(Payload, T.type_parameter(:Fallback)))
|
76
|
-
end
|
77
|
-
def payload_or(value)
|
78
|
-
value
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/lib/typed/success.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Typed
|
5
|
-
# Represents a successful result. Contains a payload and no error information.
|
6
|
-
class Success < Result
|
7
|
-
extend T::Sig
|
8
|
-
extend T::Generic
|
9
|
-
|
10
|
-
Payload = type_member
|
11
|
-
Error = type_member { { fixed: T.noreturn } }
|
12
|
-
|
13
|
-
sig { override.returns(Payload) }
|
14
|
-
attr_reader :payload
|
15
|
-
|
16
|
-
sig do
|
17
|
-
type_parameters(:T)
|
18
|
-
.params(payload: T.type_parameter(:T))
|
19
|
-
.returns(Typed::Success[T.type_parameter(:T)])
|
20
|
-
end
|
21
|
-
def self.new(payload)
|
22
|
-
super(payload)
|
23
|
-
end
|
24
|
-
|
25
|
-
sig { returns(Typed::Success[NilClass]) }
|
26
|
-
def self.blank
|
27
|
-
new(nil)
|
28
|
-
end
|
29
|
-
|
30
|
-
sig { params(payload: Payload).void }
|
31
|
-
def initialize(payload)
|
32
|
-
@payload = payload
|
33
|
-
super()
|
34
|
-
end
|
35
|
-
|
36
|
-
sig { override.returns(T::Boolean) }
|
37
|
-
def success?
|
38
|
-
true
|
39
|
-
end
|
40
|
-
|
41
|
-
sig { override.returns(T::Boolean) }
|
42
|
-
def failure?
|
43
|
-
false
|
44
|
-
end
|
45
|
-
|
46
|
-
sig { override.returns(T.noreturn) }
|
47
|
-
def error
|
48
|
-
raise NoErrorOnSuccessError
|
49
|
-
end
|
50
|
-
|
51
|
-
sig do
|
52
|
-
override
|
53
|
-
.type_parameters(:U, :T)
|
54
|
-
.params(block: T.proc.params(arg0: Payload).returns(Result[T.type_parameter(:U), T.type_parameter(:T)]))
|
55
|
-
.returns(Result[T.type_parameter(:U), T.type_parameter(:T)])
|
56
|
-
end
|
57
|
-
def and_then(&block)
|
58
|
-
block.call(payload)
|
59
|
-
end
|
60
|
-
|
61
|
-
sig do
|
62
|
-
override
|
63
|
-
.params(_block: T.proc.params(arg0: Error).void)
|
64
|
-
.returns(T.self_type)
|
65
|
-
end
|
66
|
-
def on_error(&_block)
|
67
|
-
self
|
68
|
-
end
|
69
|
-
|
70
|
-
sig do
|
71
|
-
override
|
72
|
-
.type_parameters(:Fallback)
|
73
|
-
.params(_value: T.type_parameter(:Fallback))
|
74
|
-
.returns(T.any(Payload, T.type_parameter(:Fallback)))
|
75
|
-
end
|
76
|
-
def payload_or(_value)
|
77
|
-
payload
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|