Class: Lagoon::Parser::ControllerModelParser

Inherits:
Object
  • Object
show all
Defined in:
lib/lagoon/parser/controller_model_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ControllerModelParser

Returns a new instance of ControllerModelParser.



12
13
14
15
16
17
18
# File 'lib/lagoon/parser/controller_model_parser.rb', line 12

def initialize(options = {})
  @options = options.is_a?(Options) ? options : Options.for(:controller_model, options)
  @filter = ApplicationClassFilter.new(
    directory: 'controllers',
    include_all: @options[:all_controllers]
  )
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/lagoon/parser/controller_model_parser.rb', line 10

def options
  @options
end

Instance Method Details

#parseObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/lagoon/parser/controller_model_parser.rb', line 20

def parse
  relationships = []
  warnings = []
   = (warnings)

  load_controllers.sort_by { |controller| controller.name.to_s }.each do |controller|
    next if excluded?(controller)

    analyze_controller(controller, , relationships, warnings)
  end

  aggregated = aggregate_relationships(relationships)
  {
    relationships: aggregated,
    warnings: warnings,
    counts: { relationships: aggregated.size, skipped: warnings.size }
  }
end