Skip to content

Commit

Permalink
Fix warnings about unused block arguments (fix #181)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Jan 21, 2025
1 parent 9447914 commit e7ff19c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/dry/monads/maybe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def deconstruct = EMPTY_ARRAY
# @see Maybe::Some#filter
#
# @return [Maybe::None]
def filter(_ = Undefined) = self
def filter(_ = Undefined, &) = self
end

# A module that can be included for easier access to Maybe monads.
Expand Down
4 changes: 2 additions & 2 deletions lib/dry/monads/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def flip
# Ignores values and returns self, see {Failure#alt_map}
#
# @return [Result::Success]
def alt_map(_ = nil) = self
def alt_map(_ = nil, &) = self
end

# Represents a value of a failed operation.
Expand Down Expand Up @@ -371,7 +371,7 @@ class Some < Maybe
# @param fail [#call] Fallback value
# @param block [Proc] Fallback block
# @return [Success<Any>]
def to_result(_fail = Unit) = Result::Success.new(@value)
def to_result(_fail = Unit, &) = Result::Success.new(@value)
end

class None < Maybe
Expand Down
4 changes: 2 additions & 2 deletions lib/dry/monads/right_biased.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def or_fmap(...) = self
# Returns value. It exists to keep the interface identical to that of RightBiased::Left
#
# @return [Object]
def value_or(_val = nil) = @value
def value_or(_val = nil, &) = @value

# Applies the stored value to the given argument if the argument has type of Right,
# otherwise returns the argument.
Expand Down Expand Up @@ -316,7 +316,7 @@ def flatten = self
# identical to that of {RightBiased::Right}.
#
# @return [RightBiased::Left]
def and(_) = self
def and(_, &) = self

# Pattern matching
#
Expand Down
2 changes: 1 addition & 1 deletion lib/dry/monads/try.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def to_s
# @param errors [Class] List of Exception subclasses
#
# @return [Try::Value]
def recover(*_errors) = self
def recover(*_errors, &) = self
end

# Represents a result of a failed execution.
Expand Down
6 changes: 3 additions & 3 deletions lib/dry/monads/validated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def fmap(proc = Undefined, &block)
# Ignores values and returns self, see {Invalid#alt_map}
#
# @return [Validated::Valid]
def alt_map(_ = nil) = self
def alt_map(_ = nil, &) = self

# Ignores arguments, returns self
#
# @return [Validated::Valid]
def or(_ = nil) = self
def or(_ = nil, &) = self

# @return [String]
def inspect
Expand Down Expand Up @@ -185,7 +185,7 @@ def alt_map(proc = Undefined, &block)
# Ignores the passed argument and returns self
#
# @return [Validated::Invalid]
def fmap(_ = nil) = self
def fmap(_ = nil, &) = self

# Yields the given callable and returns the result
#
Expand Down

0 comments on commit e7ff19c

Please sign in to comment.