Skip to content

Commit

Permalink
use argument forwarding when calling .constrained in Types::Builder a…
Browse files Browse the repository at this point in the history
…nd Types::Sum
  • Loading branch information
dcr8898 committed Jul 30, 2024
1 parent 7708c1a commit f00d430
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/dry/types/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def optional
# @return [Constrained]
#
# @api public
def constrained(options)
constrained_type.new(self, rule: Types.Rule(options))
def constrained(...)
constrained_type.new(self, rule: Types.Rule(...))
end

# Turn a type into a type with a default value
Expand Down
4 changes: 2 additions & 2 deletions lib/dry/types/sum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def meta(data = Undefined)
# @see Builder#constrained
#
# @api public
def constrained(options)
def constrained(...)
if optional?
right.constrained(options).optional
right.constrained(...).optional
else
super
end
Expand Down

0 comments on commit f00d430

Please sign in to comment.