Skip to content

Commit

Permalink
Fix warnings under 3.4 by changing signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Jan 7, 2025
1 parent 62b33fb commit 0ab48a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 9 additions & 9 deletions lib/dry/monads/right_biased.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ def tee(...)
# Must be implemented for a right-biased monad.
#
# @return [RightBiased::Right]
def fmap(*)
def fmap(...)
raise NotImplementedError
end

# Ignores arguments and returns self. It exists to keep the interface
# identical to that of {RightBiased::Left}.
#
# @return [RightBiased::Right]
def or(*)
def or(...)
self
end

Expand All @@ -99,7 +99,7 @@ def |(_alt)
# that is returns itselt.
#
# @return [RightBiased::Right]
def or_fmap(*)
def or_fmap(...)
self
end

Expand Down Expand Up @@ -265,23 +265,23 @@ def value!
# identical to that of {RightBiased::Right}.
#
# @return [RightBiased::Left]
def bind(*)
def bind(...)
self
end

# Ignores the input parameter and returns self. It exists to keep the interface
# identical to that of {RightBiased::Right}.
#
# @return [RightBiased::Left]
def tee(*)
def tee(...)
self
end

# Ignores the input parameter and returns self. It exists to keep the interface
# identical to that of {RightBiased::Right}.
#
# @return [RightBiased::Left]
def fmap(*)
def fmap(...)
self
end

Expand All @@ -293,7 +293,7 @@ def fmap(*)
# Dry::Monads.None.or { Time.now } # => current time
#
# @return [Object]
def or(*)
def or(...)
raise NotImplementedError
end

Expand All @@ -313,7 +313,7 @@ def |(alt)
# Dry::Monads.None.or_fmap { Time.now } # => Some(current time)
#
# @return [RightBiased::Left, RightBiased::Right]
def or_fmap(*)
def or_fmap(...)
raise NotImplementedError
end

Expand All @@ -332,7 +332,7 @@ def value_or(val = nil)
# identical to that of {RightBiased::Right}.
#
# @return [RightBiased::Left]
def apply(*)
def apply(...)
self
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dry/monads/validated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def to_monad

# Bind/flat_map is not implemented
#
def bind(*)
def bind(...)
# See https://typelevel.org/cats/datatypes/validated.html for details on why
raise NotImplementedError,
"Validated is not a monad because it would violate the monad laws"
Expand Down
2 changes: 1 addition & 1 deletion lib/json/add/dry/monads/maybe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.json_create(serialized)

# Returns a hash, that will be turned into a JSON object and represent this
# object.
def as_json(*)
def as_json(*, **)
{
JSON.create_id => self.class.name,
value: none? ? nil : @value
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

Dir["./spec/shared/**/*.rb"].each { |f| require f }

Warning.process { raise _1 }

module Kernel
def suppress_warnings
original_verbosity = $VERBOSE
Expand Down

0 comments on commit 0ab48a3

Please sign in to comment.