Class: Dumpling::ServiceBuilder
- Inherits:
-
Object
- Object
- Dumpling::ServiceBuilder
- Defined in:
- lib/dumpling/service_builder.rb
Instance Method Summary collapse
- #build(specification) ⇒ Object
-
#initialize(services, abstract_services) ⇒ ServiceBuilder
constructor
A new instance of ServiceBuilder.
Constructor Details
#initialize(services, abstract_services) ⇒ ServiceBuilder
Returns a new instance of ServiceBuilder.
3 4 5 6 |
# File 'lib/dumpling/service_builder.rb', line 3 def initialize(services, abstract_services) @services = services @abstract_services = abstract_services end |
Instance Method Details
#build(specification) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/dumpling/service_builder.rb', line 8 def build(specification) instance = service_instance(specification) dependencies = service_dependencies(specification) dependencies.each do |service_id, | service_specification = @services.get(service_id) instance.send("#{[:attribute]}=", build(service_specification)) end instance end |