Class: EagerEye::Detectors::SerializerNesting
- Defined in:
- lib/eager_eye/detectors/serializer_nesting.rb
Constant Summary collapse
- SERIALIZER_PATTERNS =
Serializer base classes to detect
[ "ActiveModel::Serializer", "ActiveModelSerializers::Model", "Blueprinter::Base", "Alba::Resource" ].freeze
- ATTRIBUTE_METHODS =
Method names that define attributes in serializers
%i[attribute field attributes].freeze
- OBJECT_REFS =
Object reference names in serializers
%i[object record resource].freeze
- ASSOCIATION_NAMES =
Common association names (same as LoopAssociation)
%w[ author user owner creator admin member customer client post article comment category tag parent company organization project task item order product account profile setting image avatar photo attachment document authors users owners creators admins members customers clients posts articles comments categories tags children companies organizations projects tasks items orders products accounts profiles settings images avatars photos attachments documents ].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.detector_name ⇒ Object
32 33 34 |
# File 'lib/eager_eye/detectors/serializer_nesting.rb', line 32 def self.detector_name :serializer_nesting end |
Instance Method Details
#detect(ast, file_path) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/eager_eye/detectors/serializer_nesting.rb', line 36 def detect(ast, file_path) return [] unless ast issues = [] traverse_ast(ast) do |node| next unless serializer_class?(node) find_nested_associations(node, file_path, issues) end issues end |