lib/avromatic/model/message_decoder.rb in avromatic-3.0.2 vs lib/avromatic/model/message_decoder.rb in avromatic-4.0.0

- old
+ new

@@ -87,10 +87,11 @@ # arg then it is used as the message value. def extract_decode_args(*args) message_key, message_value = extract_key_and_value(*args) model_key = model_key_for_message(message_key, message_value) raise UnexpectedKeyError.new(*model_key) unless model_map.key?(model_key) + [model_map[model_key], message_key, message_value] end def schema_name_for_data(data) validate_magic_byte!(data) @@ -104,11 +105,11 @@ schema_names_by_id[schema_id] = schema.fullname end end def extract_schema_id(data) - data[1..4].unpack('N').first + data[1..4].unpack1('N') end def validate_magic_byte!(data) first_byte = data[0] raise MagicByteError.new(first_byte) if first_byte != MAGIC_BYTE @@ -116,9 +117,10 @@ def build_model_map(models) models.each_with_object(Hash.new) do |model, map| key = model_key(model) raise DuplicateKeyError.new(map[key], model) if map.key?(key) && !model.equal?(map[key]) + map[key] = model end end end end