Sha256: 088a1eb0ab3ed09ae4e38ba7c676715e49986f7e9879e5690398648de9903b82

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveStubbedResults
        module Commands
          class FetchAllServicesStubbedResultsCache < Support::Command
            ##
            # @return [ConvenientService::Support::Cache]
            #
            # @internal
            #   NOTE: `::RSpec.current_example` docs.
            #   - https://www.rubydoc.info/github/rspec/rspec-core/RSpec.current_example
            #   - https://github.com/rspec/rspec-core/blob/v3.12.0/lib/rspec/core.rb#L122
            #   - https://relishapp.com/rspec/rspec-core/docs/metadata/current-example
            #
            def call
              if Dependencies.rspec.current_example
                Utils::Object.memoize_including_falsy_values(Dependencies.rspec.current_example, :@__convenient_service_stubbed_results__) { Support::Cache.create(backend: :thread_safe_array) }
              else
                Support::Cache.create(backend: :thread_safe_array)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb