Class: Dry::Validation::Rust::MessageConfig
- Inherits:
-
Object
- Object
- Dry::Validation::Rust::MessageConfig
- Defined in:
- lib/dry/validation/rust/config.rb
Overview
Configures the message backend used by compiled schemas.
Constant Summary collapse
- BACKENDS =
{ yaml: YamlBackend, i18n: I18nBackend }.freeze
Instance Attribute Summary collapse
-
#backend ⇒ :yaml, ...
The selected built-in identifier or custom backend class.
-
#default_locale ⇒ Object
Returns the value of attribute default_locale.
-
#load_paths ⇒ Object
Returns the value of attribute load_paths.
-
#top_namespace ⇒ Object
Returns the value of attribute top_namespace.
Instance Method Summary collapse
- #backend_class ⇒ Object private
- #dup ⇒ Object
-
#initialize ⇒ MessageConfig
constructor
A new instance of MessageConfig.
Constructor Details
#initialize ⇒ MessageConfig
Returns a new instance of MessageConfig.
14 15 16 17 18 19 |
# File 'lib/dry/validation/rust/config.rb', line 14 def initialize @backend = :yaml @default_locale = :en @top_namespace = :dry_validation @load_paths = [] end |
Instance Attribute Details
#backend ⇒ :yaml, ...
Returns the selected built-in identifier or custom backend class.
11 12 13 |
# File 'lib/dry/validation/rust/config.rb', line 11 def backend @backend end |
#default_locale ⇒ Object
Returns the value of attribute default_locale.
12 13 14 |
# File 'lib/dry/validation/rust/config.rb', line 12 def default_locale @default_locale end |
#load_paths ⇒ Object
Returns the value of attribute load_paths.
12 13 14 |
# File 'lib/dry/validation/rust/config.rb', line 12 def load_paths @load_paths end |
#top_namespace ⇒ Object
Returns the value of attribute top_namespace.
12 13 14 |
# File 'lib/dry/validation/rust/config.rb', line 12 def top_namespace @top_namespace end |
Instance Method Details
#backend_class ⇒ 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.
36 37 38 |
# File 'lib/dry/validation/rust/config.rb', line 36 def backend_class BACKENDS.fetch(backend, backend) end |
#dup ⇒ Object
29 30 31 32 33 |
# File 'lib/dry/validation/rust/config.rb', line 29 def dup copy = super copy.load_paths = load_paths.dup copy end |