Skip to content

Commit

Permalink
vale
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Apr 30, 2024
1 parent bb7277f commit 49f48d6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Library/Homebrew/extend/object/duplicable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
#
# That's why we hardcode the following cases and check duplicable? instead of
# using that rescue idiom.
# rubocop:disable Layout/EmptyLines


# rubocop:enable Layout/EmptyLines
class Object
# Can you safely dup this object?
#
Expand All @@ -35,17 +37,21 @@ def duplicable? = true
class Method
# Methods are not duplicable:
#
# method(:puts).duplicable? # => false
# method(:puts).dup # => TypeError: allocator undefined for Method
# ```ruby
# method(:puts).duplicable? # => false
# method(:puts).dup # => TypeError: allocator undefined for Method
# ```
sig { returns(FalseClass) }
def duplicable? = false
end

class UnboundMethod
# Unbound methods are not duplicable:
#
# method(:puts).unbind.duplicable? # => false
# method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
# ``ruby
# method(:puts).unbind.duplicable? # => false
# method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
# ```
sig { returns(FalseClass) }
def duplicable? = false
end
Expand All @@ -55,7 +61,9 @@ def duplicable? = false
module Singleton
# Singleton instances are not duplicable:
#
# Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton
# ```ruby
# Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton
# ```
sig { returns(FalseClass) }
def duplicable? = false
end

0 comments on commit 49f48d6

Please sign in to comment.