lib/dry/schema/message_compiler.rb in dry-schema-0.2.0 vs lib/dry/schema/message_compiler.rb in dry-schema-0.3.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'dry/schema/constants' require 'dry/schema/message' require 'dry/schema/message_set' require 'dry/schema/message_compiler/visitor_opts' @@ -10,11 +12,11 @@ # @api private class MessageCompiler attr_reader :messages, :options, :locale, :default_lookup_options EMPTY_OPTS = VisitorOpts.new - LIST_SEPARATOR = ', '.freeze + LIST_SEPARATOR = ', ' # @api private def initialize(messages, options = {}) @messages = messages @options = options @@ -81,10 +83,10 @@ if [left, right].flatten.map(&:path).uniq.size == 1 Message::Or.new(left, right, -> k { messages[k, default_lookup_options] }) elsif right.is_a?(Array) right else - [left, right] + [left, right].flatten.max end end # @api private def visit_namespace(node, opts)