Class: ClassMetrix::Extractors::MethodsExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/class_metrix/extractors/methods_extractor.rb

Overview

Main extractor for class methods with clean separation of concerns

Instance Method Summary collapse

Constructor Details

#initialize(classes, filters, handle_errors, options = {}) ⇒ MethodsExtractor

Returns a new instance of MethodsExtractor.



12
13
14
15
16
17
18
19
20
# File 'lib/class_metrix/extractors/methods_extractor.rb', line 12

def initialize(classes, filters, handle_errors, options = {})
  @classes = classes
  @filters = filters
  @handle_errors = handle_errors
  @options = default_options.merge(options)
  @method_collection_service = Services::Collection::MethodCollectionService.new(@options)
  @method_filter_service = Services::Filtering::MethodFilterService.new(@filters)
  @method_call_service = Services::MethodCallService.new(@handle_errors, @options)
end

Instance Method Details

#extractObject



22
23
24
25
26
27
# File 'lib/class_metrix/extractors/methods_extractor.rb', line 22

def extract
  return empty_result if @classes.empty?

  method_names = collect_and_filter_methods
  { headers: build_headers, rows: build_rows(method_names) }
end