lib/rom/elasticsearch/schema.rb in rom-elasticsearch-0.3.0 vs lib/rom/elasticsearch/schema.rb in rom-elasticsearch-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'rom/types'
require 'rom/schema'
module ROM
module Elasticsearch
@@ -17,10 +19,12 @@
# Customized output hash constructor which symbolizes keys
# and optionally applies custom read-type coercions
#
# @api private
def to_output_hash
- Types::Hash.symbolized(map { |attr| [attr.key, attr.to_read_type] }.to_h)
+ Types::Hash
+ .schema(map { |attr| [attr.key, attr.to_read_type] }.to_h)
+ .with_key_transform(&:to_sym)
end
end
end
end