Class: Goldiloader::AutoIncludeContext

Inherits:
Struct
  • Object
show all
Defined in:
lib/goldiloader/auto_include_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#association_pathObject

Returns the value of attribute association_path

Returns:

  • (Object)

    the current value of association_path



4
5
6
# File 'lib/goldiloader/auto_include_context.rb', line 4

def association_path
  @association_path
end

#model_registryObject

Returns the value of attribute model_registry

Returns:

  • (Object)

    the current value of model_registry



4
5
6
# File 'lib/goldiloader/auto_include_context.rb', line 4

def model_registry
  @model_registry
end

Class Method Details

.create_emptyObject



5
6
7
# File 'lib/goldiloader/auto_include_context.rb', line 5

def self.create_empty
  Goldiloader::AutoIncludeContext.new(Goldiloader::ModelRegistry.new, [])
end

Instance Method Details

#register_models(models) ⇒ Object Also known as: register_model



9
10
11
12
13
14
15
# File 'lib/goldiloader/auto_include_context.rb', line 9

def register_models(models)
  Array.wrap(models).each do |model|
    model.auto_include_context = self
    model_registry.register(model, association_path)
  end
  self
end