Module: Dry::Schema::Messages Private
- Defined in:
- lib/dry/schema/messages.rb,
lib/dry/schema/messages/i18n.rb,
lib/dry/schema/messages/yaml.rb,
lib/dry/schema/messages/abstract.rb,
lib/dry/schema/messages/template.rb,
lib/dry/schema/messages/namespaced.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
An API for configuring message backends
Defined Under Namespace
Classes: Abstract, I18n, Namespaced, Template, YAML
Constant Summary collapse
- BACKENDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ i18n: "I18n", yaml: "YAML" }.freeze
Instance Method Summary collapse
- #setup(config) ⇒ Object private
Instance Method Details
#setup(config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dry/schema/messages.rb', line 16 public def setup(config) backend_class = BACKENDS.fetch(config.backend) do raise "+#{config.backend}+ is not a valid messages identifier" end namespace = config.namespace = config.to_h.select { |k, _| Abstract.setting_names.include?(k) } = Messages.const_get(backend_class).build() return .namespaced(namespace) if namespace end |