lib/receptacle/method_cache.rb in receptacle-0.3.1 vs lib/receptacle/method_cache.rb in receptacle-1.0.0
- old
+ new
@@ -1,6 +1,7 @@
# frozen_string_literal: true
+
module Receptacle
# Cache describing which strategy and wrappers need to be applied for this method
# @api private
class MethodCache
# @return [Symbol] name of the method this cache belongs to
@@ -14,10 +15,10 @@
# @return [Symbol] name of the after action method
attr_reader :after_method_name
# @return [Integer] arity of strategy method according to https://ruby-doc.org/core-2.3.3/Method.html#method-i-arity
attr_reader :arity
- def initialize(method_name:, strategy:, wrappers:) # rubocop:disable Metrics/AbcSize
+ def initialize(method_name:, strategy:, wrappers:)
@strategy = strategy
@before_method_name = :"before_#{method_name}"
@after_method_name = :"after_#{method_name}"
@method_name = method_name.to_sym
before_wrappers = wrappers.select { |w| w.method_defined?(@before_method_name) }