Sha256: cba73f173bd91717c0c62f6eff135eb32de492507e27fa88a021a4e8d3628119

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

![dry-monads-sorbet](https://user-images.githubusercontent.com/2643026/69986703-dfc68200-1535-11ea-9035-38ecbdb67138.png)

# Dry Monads Sorbet ![CI Badge](https://github.com/tricycle/dry-monads-sorbet/workflows/RSpec%20Test%20Suite/badge.svg)

Sorbet type hints for Dry::Monads.

## Installation

Add the gem to your Gemfile:

`gem 'dry-monads-sorbet'`

### Copying the bundled RBI

You must copy in the bundled `.rbi` file that this gem maintains to add type annotations to your own project to type check your usage of `Dry::Monads`.

Following in the footsteps of `sorbet-rails` we've extracted this process to a rake task.

### In a Rails project:

The rake task that copies the bundled `.rbi` files into your project should already be loaded. You can run it by entering:

```bash
bundle exec rake dry_monads_sorbet:update_rbi
```

### Outside of Rail's projects:

Include the `Rakefile` in your own projects `Rakefile` to get access to the rbi update command:

```ruby
require 'dry-monads-sorbet'

spec = Gem::Specification.find_by_name 'dry-monads-sorbet'
rakefile = "#{spec.gem_dir}/lib/dry-monads-sorbet/Rakefile"
load rakefile
```

After including the Rakefile you should then have access to the task as described in the Rails project section.

## Usage

```ruby
require 'dry/monads/sorbet'

class MyClass
  extend T::Sig

  sig{returns(Dry::Monads::Result[StandardError, String])}
  def my_result
  ...
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-monads-sorbet-1.1.0.pre.13 README.md
dry-monads-sorbet-1.1.0.pre.12 README.md
dry-monads-sorbet-1.1.0.pre.11 README.md
dry-monads-sorbet-1.1.0.pre.10 README.md