Class: Generamba::GenCommandTableParametersFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/generamba/helpers/gen_command_table_parameters_formatter.rb

Overview

Provides methods for prepare parameters for displaying in table.

Class Method Summary collapse

Class Method Details

.prepare_parameters_for_displaying(code_module, template_name) ⇒ Object

This method prepared parameter for displaying



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generamba/helpers/gen_command_table_parameters_formatter.rb', line 7

def self.prepare_parameters_for_displaying(code_module, template_name)
  params = {}

  params['Targets'] = code_module.project_targets.join(',') if code_module.project_targets
  params['Module path'] = code_module.project_file_path if code_module.project_file_path

  if code_module.project_file_path != code_module.project_group_path
    params['Module group path'] = code_module.project_group_path
  end

  params['Test targets'] = code_module.test_targets.join(',') if code_module.test_targets
  params['Test file path'] = code_module.test_file_path if code_module.test_file_path

  if code_module.test_file_path != code_module.test_group_path
    params['Test group path'] = code_module.test_group_path
  end

  params['Template'] = template_name

  unless code_module.custom_parameters.empty?
    params['Custom parameters'] = code_module.custom_parameters.to_json
  end

  params
end