I’m using dry-rails v. 0.3 and have the following issue: MyAppName::Import constant is uninitialized. I’m not sure if I should do some initialization, the documentation states:
The auto-injection mechanism is also set up for you automatically.
dry-rb - dry-rails v0.1 - Introduction
I have the following configuration:
# config/initializers/system.rb
# frozen_string_literal: true
Dry::Rails.container do
auto_register!('app/operations')
register(:logger, Logger.new($stdout))
end
Both files from operations and logger are visible when using MyAppName::Container, for example:
ShoperIntegrator::Container['products.generate_shoper_description']
In the app/operations/debug I have the following 2 files:
# app/operations/debug/printer.rb
module Debug
class Printer
def print(message)
puts "Debug::Printer: #{message}"
end
end
end
# app/operations/debug/try_inject.rb
module Debug
class TryInject
# This one does not work
# include ShoperIntegrator::Import['debug.printer']
def perform
# This one works
printer = ShoperIntegrator::Container['debug.printer']
printer.print('Hey!')
end
end
end
And again, here Container woks perfectly and Import not at all.
Did I missed some configuration step?