Class: ClassMetrix::Formatters::Components::TableComponent::RowProcessor
- Inherits:
-
Object
- Object
- ClassMetrix::Formatters::Components::TableComponent::RowProcessor
- Defined in:
- lib/class_metrix/formatters/components/table_component/row_processor.rb
Instance Method Summary collapse
-
#initialize(data_extractor, options = {}) ⇒ RowProcessor
constructor
A new instance of RowProcessor.
- #process_expanded_rows(rows) ⇒ Object
- #process_simple_rows(rows) ⇒ Object
Constructor Details
#initialize(data_extractor, options = {}) ⇒ RowProcessor
Returns a new instance of RowProcessor.
10 11 12 13 14 |
# File 'lib/class_metrix/formatters/components/table_component/row_processor.rb', line 10 def initialize(data_extractor, = {}) @data_extractor = data_extractor @hide_main_row = .fetch(:hide_main_row, false) @hide_key_rows = .fetch(:hide_key_rows, true) # Default: show only main rows end |
Instance Method Details
#process_expanded_rows(rows) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/class_metrix/formatters/components/table_component/row_processor.rb', line 27 def (rows) = [] # : Array[Array[String]] rows.each do |row| if @data_extractor.(row) .concat((row)) else << process_non_hash_row(row) end end end |
#process_simple_rows(rows) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/class_metrix/formatters/components/table_component/row_processor.rb', line 16 def process_simple_rows(rows) rows.map do |row| processed_row = [row[0]] # Keep the behavior name as-is rest_values = row[1..] || [] rest_values.each do |value| processed_row << ValueProcessor.process(value) end processed_row end end |