Class: Factrey::Blueprint::Instantiator

Inherits:
Object
  • Object
show all
Defined in:
lib/factrey/blueprint/instantiator.rb

Overview

An internal class used by #instantiate.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, blueprint) ⇒ Instantiator

Returns a new instance of Instantiator.

Parameters:



14
15
16
17
18
19
# File 'lib/factrey/blueprint/instantiator.rb', line 14

def initialize(context, blueprint)
  @context = context
  @objects = {}
  @visited = Set.new
  @blueprint = blueprint
end

Instance Attribute Details

#objectsHash{Symbol => Object} (readonly)

Returns:

  • (Hash{Symbol => Object})


10
11
12
# File 'lib/factrey/blueprint/instantiator.rb', line 10

def objects
  @objects
end

Instance Method Details

#instantiate_objectsObject



21
22
23
24
# File 'lib/factrey/blueprint/instantiator.rb', line 21

def instantiate_objects
  @blueprint.nodes.each_value { ensure_object_instantiated(_1) }
  @objects
end