Sha256: 6e20bf8d92b03ca9204d49aa14d8cc3736f9aaa20dd46872308336d53bcb8566
Contents?: true
Size: 734 Bytes
Versions: 10
Compression:
Stored size: 734 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module EacRailsGemSupport module FactoryBot class InstanceRegistry class << self def default @default ||= ::EacRailsGemSupport::FactoryBot::InstanceRegistry.new end delegate :fetch, :reset, to: :default def sanitize_key(key) key.to_sym end end def fetch(key) key = self.class.sanitize_key(key) if fetched.key?(key) fetched.fetch(key) else fetched[key] = ::FactoryBot.create(key) end end def reset @fetched = nil end private def fetched @fetched ||= {} end end end end
Version data entries
10 entries across 10 versions & 1 rubygems