lib/avromatic/model/raw_serialization.rb in avromatic-0.6.1 vs lib/avromatic/model/raw_serialization.rb in avromatic-0.6.2
- old
+ new
@@ -1,7 +1,6 @@
require 'avromatic/model/passthrough_serializer'
-require 'active_support/core_ext/hash/transform_values'
module Avromatic
module Model
# This module provides serialization support for encoding directly to Avro
@@ -48,10 +47,12 @@
result[key.to_s] = if value.is_a?(Avromatic::Model::Attributes)
value.value_attributes_for_avro
elsif array_of_models?(key)
value.map(&:value_attributes_for_avro)
elsif hash_of_models?(key)
- value.transform_values(&:value_attributes_for_avro)
+ value.each_with_object({}) do |(k, v), hash|
+ hash[k] = v.value_attributes_for_avro
+ end
else
avro_serializer[key].call(value)
end
end
end