# class ActiveRecord::FixtureSet::ClassCache

### Public Class Methods

new(class_names, config) click to toggle source

    # File lib/active_record/fixtures.rb, line 480
    def initialize(class_names, config)
      @class_names = class_names.stringify_keys
      @config      = config

      # Remove string values that aren't constants or subclasses of AR
      @class_names.delete_if { |klass_name, klass| !insert_class(@class_names, klass_name, klass) }
    end

### Public Instance Methods

[](fs_name) click to toggle source

    # File lib/active_record/fixtures.rb, line 488
    def [](fs_name)
      @class_names.fetch(fs_name) {
        klass = default_fixture_model(fs_name, @config).safe_constantize
        insert_class(@class_names, fs_name, klass)
      }
    end

### Private Instance Methods

default_fixture_model(fs_name, config) click to toggle source

    # File lib/active_record/fixtures.rb, line 506
    def default_fixture_model(fs_name, config)
      ActiveRecord::FixtureSet.default_fixture_model_name(fs_name, config)
    end

insert_class(class_names, name, klass) click to toggle source

    # File lib/active_record/fixtures.rb, line 497
    def insert_class(class_names, name, klass)
      # We only want to deal with AR objects.
      if klass && klass < ActiveRecord::Base
        class_names[name] = klass
      else
        class_names[name] = nil
      end
    end