Class: TypedConfig::Setup
- Inherits:
-
Object
- Object
- TypedConfig::Setup
- Extended by:
- T::Sig
- Defined in:
- lib/typed_config/setup.rb
Instance Method Summary collapse
- #call(config_path:, env: T.cast(ENV['RACK_ENV'], String)) ⇒ Object
-
#initialize(loader: Loader.new) ⇒ Setup
constructor
A new instance of Setup.
Constructor Details
Instance Method Details
#call(config_path:, env: T.cast(ENV['RACK_ENV'], String)) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/typed_config/setup.rb', line 18 def call(config_path:, env: T.cast(ENV['RACK_ENV'], String)) config_file = "#{config_path}/config.rb" return unless File.file?(config_file) require_relative config_file settings = build_settings(config_path: config_path, env: env) definition = TypeCoerce[Structs::Settings].new.from(settings) Object.const_set(Schema.schema_const_name, definition) end |