Skip to content

Commit

Permalink
Document all defaults as being lambdas (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny authored Feb 5, 2025
1 parent 6ae0e82 commit efb5017
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,15 @@ end

### Defaults

Inputs can be optional by providing a `default` value or lambda.
Inputs can be optional by providing a `default` value in a lambda.

```rb
class BuildGreeting < Actor
input :name
input :adjective, default: "wonderful"
input :adjective, default: -> { "wonderful" }
input :length_of_time, default: -> { ["day", "week", "month"].sample }
input :article,
default: -> context { context.adjective.match?(/^[aeiou]/) ? "an" : "a" }
default: -> actor { actor.adjective.match?(/^[aeiou]/) ? "an" : "a" }

output :greeting

Expand Down

0 comments on commit efb5017

Please sign in to comment.