Total Complexity | 1 |
Total Lines | 13 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
11 | class Analyzer |
||
12 | # @param [Class, Module] klass |
||
13 | # @return [AMA::Entity::Mapper:Type] |
||
14 | def self.analyze(klass) |
||
15 | type = Type.new(klass) |
||
16 | writers = klass.instance_methods.grep(/\w+=$/) |
||
17 | writers.map do |writer| |
||
18 | attribute = writer[0..-2] |
||
19 | type.attribute!(attribute, Type::Any::INSTANCE, nullable: true) |
||
20 | end |
||
21 | type |
||
22 | end |
||
23 | end |
||
24 | end |
||
28 |