All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Add minitest assertions for Results
- Switched to Standard over using Rubocop directly
- Remove support for Ruby < 3.0
- Add
#on_error
toTyped::Result
to allow behavior when an error is encountered during chaining. - Add
#payload_or
toTyped::Result
to allow callers to specify a default value ifFailure
is returned.
- Add
.blank
to create aTyped::Success
with anil
payload or aTyped::Failure
with anil
error. - Add
#and_then
toTyped::Result
to allow chaining of results. See #14 for more details.
- Breaking Make
Typed::Success#Error
andTyped::Failure#Payload
fixed toT.noreturn
. This allows to specify the other type_member only when using generics. See #8 for more details - Breaking Remove
T.nilable
fromPayload
andError
parameters inTyped::Success.new
andTyped::Failure.new
. Nilability will now need to be specified in the generic type. This also means that you'll need to use the new.blank
instead of.new
when you want to create aTyped::Success
orTyped::Failure
with anil
payload or error. - Breaking Change
Typed::Success
andTyped::Failure
initialize arguments from keyword to positional. - Improve
Typed::Success.new
andTyped::Failure.new
to make them generic methods and automatically infer the type of thepayload
anderror
arguments. See #8 for more details
- Automated gem release process
- Update dependencies
- Breaking Updated all
T::
modules toTyped::
. This allows the Sorbet project freedom to explore these constants in the future. - Pulled in Zeitwerk for autoloading.
- Updated
T::Result
to be an abstract class, instead of an interface module.
bin/console
now requires the correct file.
T::Result
,T::Success
andT::Failure
types.- Basic documentation.