class ActiveValidation::Configuration
Attributes
manifest_name_formatter[RW]
method_name_values_registry[R]
orm_adapter[R]
orm_adapters_registry[R]
validation_context_formatter[RW]
verifiers_registry[R]
Public Class Methods
new()
click to toggle source
# File lib/active_validation/configuration.rb, line 7 def initialize @orm_adapters_registry = Registry.new("Orm adapters") @verifiers_registry = strict_registry name: "Verifiers", klass: Verifier @method_name_values_registry = strict_registry name: "Validation methods", klass: Values::MethodName @manifest_name_formatter = Formatters::ManifestNameFormatter @validation_context_formatter = Formatters::ValidationContextFormatter end
Public Instance Methods
orm_adapter=(name, retry_attempt: 0)
click to toggle source
# File lib/active_validation/configuration.rb, line 20 def orm_adapter=(name, retry_attempt: 0) retry_attempt += 1 @orm_adapter = case name when BaseAdapter name when Class name.new when String, Symbol "ActiveValidation::OrmPlugins::#{name.to_s.classify}Plugin::Adapter".constantize.new else raise ArgumentError "ORM plugin not found" end rescue NameError raise if retry_attempt > 1 require_relative "orm_plugins/#{name}_plugin/adapter" retry end
verifier_defaults(&block)
click to toggle source
# File lib/active_validation/configuration.rb, line 39 def verifier_defaults(&block) @verifier_defaults ||= ->(_config) {} return @verifier_defaults unless block_given? @verifier_defaults = block end
Private Instance Methods
strict_registry(name:, klass:)
click to toggle source
# File lib/active_validation/configuration.rb, line 48 def strict_registry(name:, klass:) Decorators::ConsistentRegistry.new(klass, Decorators::DisallowsDuplicatesRegistry.new(Registry.new(name))) end