Code Duplication    Length = 9-9 lines in 7 locations

lib/mapper/handler/attribute/validator.rb 1 location

@@ 70-78 (lines=9) @@
67
68
              # @param [Validator] validator
69
              # @return [Validator]
70
              def wrap(validator)
71
                handler = handler_factory(validator, INSTANCE)
72
                description = "Safety wrapper for #{validator}"
73
                wrapper = method_object(:validate, to_s: description, &handler)
74
                wrapper.singleton_class.instance_eval do
75
                  include Mixin::Errors
76
                end
77
                wrapper
78
              end
79
80
              private
81

lib/mapper/handler/entity/denormalizer.rb 1 location

@@ 60-68 (lines=9) @@
57
58
              # @param [Denormalizer] implementation
59
              # @return [Denormalizer]
60
              def wrap(implementation)
61
                handler = handler_factory(implementation, INSTANCE)
62
                depiction = "Safety wrapper for #{implementation}"
63
                wrapper = method_object(:denormalize, to_s: depiction, &handler)
64
                wrapper.singleton_class.instance_eval do
65
                  include Mixin::Errors
66
                end
67
                wrapper
68
              end
69
70
              private
71

lib/mapper/handler/entity/factory.rb 1 location

@@ 50-58 (lines=9) @@
47
48
              # @param [Factory] implementation
49
              # @return [Factory]
50
              def wrap(implementation)
51
                handler = handler_factory(implementation, INSTANCE)
52
                description = "Safety wrapper for #{implementation}"
53
                wrapper = method_object(:create, to_s: description, &handler)
54
                wrapper.singleton_class.instance_eval do
55
                  include Mixin::Errors
56
                end
57
                wrapper
58
              end
59
60
              private
61

lib/mapper/handler/entity/enumerator.rb 1 location

@@ 37-45 (lines=9) @@
34
35
              # @param [Enumerator] implementation
36
              # @return [Enumerator]
37
              def wrap(implementation)
38
                handler = handler_factory(implementation, INSTANCE)
39
                description = "Safety wrapper for #{implementation}"
40
                wrapper = method_object(:enumerate, to_s: description, &handler)
41
                wrapper.singleton_class.instance_eval do
42
                  include Mixin::Errors
43
                end
44
                wrapper
45
              end
46
47
              private
48

lib/mapper/handler/entity/injector.rb 1 location

@@ 33-41 (lines=9) @@
30
31
              # @param [Injector] implementation
32
              # @return [Injector]
33
              def wrap(implementation)
34
                handler = handler_factory(implementation, INSTANCE)
35
                description = "Safety wrapper for #{implementation}"
36
                wrapper = method_object(:inject, to_s: description, &handler)
37
                wrapper.singleton_class.instance_eval do
38
                  include Mixin::Errors
39
                end
40
                wrapper
41
              end
42
43
              private
44

lib/mapper/handler/entity/normalizer.rb 1 location

@@ 32-40 (lines=9) @@
29
30
              # @param [Normalizer] implementation
31
              # @return [Normalizer]
32
              def wrap(implementation)
33
                handler = handler_factory(implementation, INSTANCE)
34
                description = "Safety wrapper for #{implementation}"
35
                wrapper = method_object(:normalize, to_s: description, &handler)
36
                wrapper.singleton_class.instance_eval do
37
                  include Mixin::Errors
38
                end
39
                wrapper
40
              end
41
42
              private
43

lib/mapper/handler/entity/validator.rb 1 location

@@ 30-38 (lines=9) @@
27
28
              # @param [Validator] validator
29
              # @return [Validator]
30
              def wrap(validator)
31
                handler = handler_factory(validator, INSTANCE)
32
                description = "Safety wrapper for #{validator}"
33
                wrapper = method_object(:validate, to_s: description, &handler)
34
                wrapper.singleton_class.instance_eval do
35
                  include Mixin::Errors
36
                end
37
                wrapper
38
              end
39
40
              private
41