Sha256: 973d22bbb87a17c121622550a41e63486ad06170ed45eff2a51fcfd0b7e4f5f5
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Service module Plugins module CanHaveStubbedResult class Middleware < Core::MethodChainMiddleware ## # @param args [Array<Object>] # @param kwargs [Hash{Symbol => Object}] # @param block [Proc, nil] # @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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
convenient_service-0.12.0 | lib/convenient_service/service/plugins/can_have_stubbed_result/middleware.rb |