lib/dry/schema/message_compiler.rb in dry-schema-1.8.0 vs lib/dry/schema/message_compiler.rb in dry-schema-1.9.0
- old
+ new
@@ -28,18 +28,18 @@
DEFAULT_PREDICATE_RESOLVERS = Hash
.new(resolve_predicate).update(key?: resolve_key_predicate).freeze
EMPTY_OPTS = VisitorOpts.new
EMPTY_MESSAGE_SET = MessageSet.new(EMPTY_ARRAY).freeze
- FULL_MESSAGE_WHITESPACE = Hash.new(' ').merge(
- ja: '',
- zh: '',
- bn: '',
- th: '',
- lo: '',
- my: '',
- )
+ FULL_MESSAGE_WHITESPACE = Hash.new(" ").merge(
+ ja: "",
+ zh: "",
+ bn: "",
+ th: "",
+ lo: "",
+ my: ""
+ )
param :messages
option :full, default: -> { false }
option :locale, default: -> { :en }
@@ -204,11 +204,12 @@
text = template[template.data(tokens)]
return text if !text || !full
rule = options[:path]
- [messages.rule(rule, options) || rule, text].join(FULL_MESSAGE_WHITESPACE[template.options[:locale]])
+ [messages.rule(rule, options) || rule,
+ text].join(FULL_MESSAGE_WHITESPACE[template.options[:locale]])
end
# @api private
def message_tokens(args)
tokens = args.each_with_object({}) do |arg, hash|
@@ -226,10 +227,12 @@
end
# @api private
def append_mapped_size_tokens(tokens)
# this is a temporary fix for the inconsistency in the "size" errors arguments
- mapped_hash = tokens.each_with_object({}) { |(k, v), h| h[k.to_s.gsub("size", "num").to_sym] = v }
+ mapped_hash = tokens.each_with_object({}) { |(k, v), h|
+ h[k.to_s.gsub("size", "num").to_sym] = v
+ }
tokens.merge(mapped_hash)
end
end
end
end