Conditions | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
23 | def denormalize(source, context, target_type) |
||
24 | return source if source.is_a?(target_type.type) |
||
25 | handler = compute_handler(target_type, context) |
||
26 | return target_type.type.send(handler, source, context) if handler |
||
27 | entity = target_type.factory.create(context, source) |
||
28 | extractor = target_type.extractor(source) |
||
29 | acceptor = target_type.acceptor(entity, context) |
||
30 | extractor.each do |attribute, value, segment = nil| |
||
31 | acceptor.accept(attribute, value, segment) |
||
32 | end |
||
33 | entity |
||
34 | end |
||
35 | |||
48 |