lib/dry/schema/rule_applier.rb in dry-schema-0.3.0 vs lib/dry/schema/rule_applier.rb in dry-schema-0.4.0

- old
+ new

@@ -18,31 +18,32 @@ # @api private param :rules # @api private - option :config, default: proc { Config.new } + option :config, default: -> { Config.new } # @api private - option :message_compiler, default: proc { MessageCompiler.new(Messages.setup(config)) } + option :message_compiler, default: -> { MessageCompiler.new(Messages.setup(config.messages)) } # @api private def call(input) results = EMPTY_ARRAY.dup rules.each do |name, rule| next if input.error?(name) + result = rule.(input) results << result if result.failure? end input.concat(results) end # @api private def to_ast - if config.namespace - [:namespace, [config.namespace, [:set, rules.values.map(&:to_ast)]]] + if config.messages.namespace + [:namespace, [config.messages.namespace, [:set, rules.values.map(&:to_ast)]]] else [:set, rules.values.map(&:to_ast)] end end end