| Total Complexity | 1 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # frozen_string_literal: true |
||
| 12 | class Normalizer < API::Normalizer |
||
| 13 | include Mixin::Reflection |
||
| 14 | |||
| 15 | INSTANCE = new |
||
| 16 | |||
| 17 | # @param [Object] entity |
||
| 18 | # @param [AMA::Entity::Mapper::Type] type |
||
| 19 | # @param [AMA::Entity::Mapper::Context] _context |
||
| 20 | def normalize(entity, type, _context = nil) |
||
| 21 | type.attributes.values.each_with_object({}) do |attribute, data| |
||
| 22 | next if attribute.virtual || attribute.sensitive |
||
| 23 | data[attribute.name] = object_variable(entity, attribute.name) |
||
| 24 | end |
||
| 25 | end |
||
| 26 | end |
||
| 27 | end |
||
| 32 |