Code Duplication    Length = 8-9 lines in 2 locations

lib/mapper/engine/denormalizer.rb 1 location

@@ 34-42 (lines=9) @@
31
          # @param [AMA::Entity::Mapper::Type] target_type
32
          # @param [AMA::Entity::Mapper::Context] context
33
          # @return [Object] Object of target type
34
          def denormalize_internal(source, target_type, context)
35
            denormalizer = target_type.denormalizer
36
            denormalizer.denormalize(source, target_type, context)
37
          rescue StandardError => e
38
            raise_if_internal(e)
39
            message = "Error while denormalizing #{target_type} " \
40
              "out of #{source.class}"
41
            mapping_error(message, parent: e, context: context)
42
          end
43
        end
44
      end
45
    end

lib/mapper/engine/normalizer.rb 1 location

@@ 20-27 (lines=8) @@
17
          # @param [AMA::Entity::Mapper::Type] source_type
18
          # @param [AMA::Entity::Mapper::Context] context
19
          # @return [Object]
20
          def normalize(value, source_type, context)
21
            normalizer = source_type.normalizer
22
            normalizer.normalize(value, source_type, context)
23
          rescue StandardError => e
24
            raise_if_internal(e)
25
            message = "Error while normalizing #{value.class}"
26
            mapping_error(message, context: context, parent: e)
27
          end
28
        end
29
      end
30
    end