lib/compel/validators/hash_validator.rb in compel-0.3.7 vs lib/compel/validators/hash_validator.rb in compel-0.4.0

- old
+ new

@@ -18,22 +18,20 @@ def validate unless root_hash_valid? return self end - @input = Hashie::Mash.new(input) - keys_validator = \ HashKeysValidator.validate(input, keys_schemas) @errors = keys_validator.errors @output = keys_validator.output self end def serialize - coerced = output.is_a?(Hash) ? input.merge(output) : Hashie::Mash.new + coerced = output.is_a?(Hash) ? input.merge(output) : {} coerced.tap do |hash| if !errors.empty? hash[:errors] = serialize_errors end