Class: ClassMetrix::Formatters::Components::HeaderComponent
- Inherits:
-
Object
- Object
- ClassMetrix::Formatters::Components::HeaderComponent
- Defined in:
- lib/class_metrix/formatters/components/header_component.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(data, options = {}) ⇒ HeaderComponent
constructor
A new instance of HeaderComponent.
Constructor Details
#initialize(data, options = {}) ⇒ HeaderComponent
Returns a new instance of HeaderComponent.
7 8 9 10 11 12 13 14 15 |
# File 'lib/class_metrix/formatters/components/header_component.rb', line 7 def initialize(data, = {}) @data = data @options = @title = [:title] @extraction_types = [:extraction_types] || [] @show_metadata = .fetch(:show_metadata, true) @show_classes = .fetch(:show_classes, true) @show_extraction_info = .fetch(:show_extraction_info, true) end |
Instance Method Details
#generate ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/class_metrix/formatters/components/header_component.rb', line 17 def generate output = [] # : Array[String] # Add title output.concat(generate_title) if @title || @show_metadata # Add classes being analyzed output.concat(generate_classes_section) if @show_classes # Add extraction types info output.concat(generate_extraction_info) if @show_extraction_info && !@extraction_types.empty? output end |