lib/dry/validation/message_set.rb in dry-validation-1.0.0.rc3 vs lib/dry/validation/message_set.rb in dry-validation-1.0.0
- old
+ new
@@ -25,21 +25,21 @@
# @api public
attr_reader :locale
# @api private
def initialize(messages, options = EMPTY_HASH)
- @locale = options.fetch(:locale, :en)
+ @locale = options[:locale]
@source_messages = options.fetch(:source) { messages.dup }
super
end
# Return a new message set using updated options
#
# @return [MessageSet]
#
# @api private
def with(other, new_options = EMPTY_HASH)
- return self if new_options.empty?
+ return self if new_options.empty? && other.eql?(messages)
self.class.new(
(other + select { |err| err.is_a?(Message) }).uniq,
options.merge(source: source_messages, **new_options)
).freeze