class FactoryBotCaching::CacheManager

Attributes

factory_cache[R]

Public Class Methods

instance() click to toggle source
# File lib/factory_bot_caching/cache_manager.rb, line 29
def self.instance
  @instance ||= self.new
end
new() click to toggle source
# File lib/factory_bot_caching/cache_manager.rb, line 33
def initialize
  @factory_cache = Hash.new do |hash, key|
    hash[key] = FactoryCache.new(factory_name: key)
  end
end

Public Instance Methods

fetch(name:, overrides:, traits:, &block) click to toggle source
# File lib/factory_bot_caching/cache_manager.rb, line 47
def fetch(name:, overrides:, traits:, &block)
  factory_cache[name].fetch(overrides: overrides, traits: traits, &block)
end
reset_cache() click to toggle source
# File lib/factory_bot_caching/cache_manager.rb, line 39
def reset_cache
  factory_cache.each_value(&:reset)
end
reset_cache_counter() click to toggle source
# File lib/factory_bot_caching/cache_manager.rb, line 43
def reset_cache_counter
  factory_cache.each_value(&:reset_counter)
end