Class: AnnotateRb::ModelAnnotator::RelatedFilesListBuilder
- Inherits:
-
Object
- Object
- AnnotateRb::ModelAnnotator::RelatedFilesListBuilder
- Defined in:
- lib/annotate_rb/model_annotator/related_files_list_builder.rb
Overview
Given a model file and options, this class will return a list of related files (e.g. fixture, controllers, etc) to also annotate
Constant Summary collapse
- RELATED_TYPES =
%w[test fixture factory serializer scaffold controller helper].freeze
- EXCLUDE_TEST_OPTIONS =
Valid options when ‘:exclude_tests` is an Array, note that symbols are expected
%i[model controller serializer request routing].freeze
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(file, model_name, table_name, options) ⇒ RelatedFilesListBuilder
constructor
A new instance of RelatedFilesListBuilder.
Constructor Details
#initialize(file, model_name, table_name, options) ⇒ RelatedFilesListBuilder
Returns a new instance of RelatedFilesListBuilder.
13 14 15 16 17 18 |
# File 'lib/annotate_rb/model_annotator/related_files_list_builder.rb', line 13 def initialize(file, model_name, table_name, ) @file = file @model_name = model_name @table_name = table_name @options = end |
Instance Method Details
#build ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/annotate_rb/model_annotator/related_files_list_builder.rb', line 20 def build @list = [] if !exclude_model_test_files? if !@options[:exclude_fixtures] if !@options[:exclude_factories] if !@options[:exclude_serializers] if !exclude_serializer_tests? if !exclude_controller_tests? if !exclude_request_specs? if !exclude_routing_specs? if !@options[:exclude_controllers] if !@options[:exclude_helpers] if @options[:active_admin] add_additional_file_patterns if @options[:additional_file_patterns].present? @list.uniq end |