lib/dry/system/booter.rb in dry-system-0.10.1 vs lib/dry/system/booter.rb in dry-system-0.11.0

- old
+ new

@@ -68,10 +68,19 @@ freeze end # @api private + def shutdown + components.each do |component| + next unless booted.include?(component) + + stop(component) + end + end + + # @api private def init(name_or_component) with_component(name_or_component) do |component| call(component) do component.init.finalize yield if block_given? @@ -98,10 +107,13 @@ # @api private def stop(name_or_component) call(name_or_component) do |component| raise ComponentNotStartedError.new(name_or_component) unless booted.include?(component) + component.stop + booted.delete(component) + yield if block_given? end end # @api private