lib/tacky.rb in tacky-0.3.5 vs lib/tacky.rb in tacky-0.4.0

- old
+ new

@@ -1,10 +1,10 @@ # frozen_string_literal: true # (The MIT License) # -# Copyright (c) 2020 Yegor Bugayenko +# Copyright (c) 2020-2023 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -27,11 +27,11 @@ # # For more information read # {README}[https://github.com/yegor256/tacky/blob/master/README.md] file. # # Author:: Yegor Bugayenko (yegor256@gmail.com) -# Copyright:: Copyright (c) 2020 Yegor Bugayenko +# Copyright:: Copyright (c) 2020-2023 Yegor Bugayenko # License:: MIT class Tacky undef_method :send # Deep nesting will stop at these classes. @@ -54,12 +54,10 @@ @mutex.synchronize do unless @cache.key?(args) @cache[args] = @origin.__send__(*args) do |*a| yield(*a) if block_given? end - if @deep && STOP.none? { |t| @cache[args].is_a?(t) } - @cache[args] = Tacky.new(@cache[args], deep: @deep) - end + @cache[args] = Tacky.new(@cache[args], deep: @deep) if @deep && STOP.none? { |t| @cache[args].is_a?(t) } end @cache[args] end end