Sha256: e342bf1d75963fb6b5f23dd68624d6a260a67923fbfc72264f2b7b2ec5c5791a
Contents?: true
Size: 955 Bytes
Versions: 11
Compression:
Stored size: 955 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Service module Plugins module CanHaveStubbedResult class Middleware < Core::MethodChainMiddleware ## # @param args [Array] # @param kwargs [Hash] # @param block [Proc] # @return [Object] Can be any type. # def next(*args, **kwargs, &block) key_with_arguments = cache.keygen(*args, **kwargs, &block) key_without_arguments = cache.keygen return cache[key_with_arguments] if cache.exist?(key_with_arguments) return cache[key_without_arguments] if cache.exist?(key_without_arguments) chain.next(*args, **kwargs, &block) end private ## # @return [ConvenientService::Support::Cache] # def cache entity.stubbed_results end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems