Skip to content

Commit

Permalink
Fix docs for #generate
Browse files Browse the repository at this point in the history
  • Loading branch information
ismasan committed Oct 24, 2024
1 parent 24a503b commit 7cf4d7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,15 @@ So, normally you'd only use this attached to primitive types without further pro
Passing a proc will evaluate the proc on every invocation. Use this for generated values.

```ruby
random_number = Types::Numeric.static { rand }
random_number = Types::Numeric.generate { rand }
random_number.parse # 0.32332
random_number.parse('foo') # 0.54322 etc
```

Note that the type of generated value must match the initial step's type, validated at invocation.

```ruby
random_number = Types::String.static { rand } # this won't raise an error here
random_number = Types::String.generate { rand } # this won't raise an error here
random_number.parse # raises Plumb::ParseError because `rand` is not a String
```

Expand Down

0 comments on commit 7cf4d7d

Please sign in to comment.