lib/dry/rails/boot/application_contract.rb in dry-rails-0.4.0 vs lib/dry/rails/boot/application_contract.rb in dry-rails-0.5.0
- old
+ new
@@ -1,18 +1,19 @@
# frozen_string_literal: true
-Dry::System.register_component(:application_contract, provider: :rails) do
- init do
+Dry::System.register_provider_source(:application_contract, group: :rails) do
+ prepare do
require "dry/rails/features/application_contract"
+ @railtie = target_container[:railtie]
end
start do
- railtie.set_or_reload(
+ @railtie.set_or_reload(
:ApplicationContract,
- Class.new(Dry::Rails::Features::ApplicationContract).finalize!(railtie)
+ Class.new(Dry::Rails::Features::ApplicationContract).finalize!(@railtie)
)
end
stop do
- railtie.remove_constant(:ApplicationContract)
+ @railtie.remove_constant(:ApplicationContract)
end
end