Class: GeneratorPartials

Inherits:
Object show all
Defined in:
lib/ceedling/generators/generator_partials.rb

Instance Method Summary collapse

Instance Method Details

#generate_implementation(test:, name:, function_definitions:, source_includes:, header_includes:, c_module:, output_path:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ceedling/generators/generator_partials.rb', line 16

def generate_implementation(
    test:,
    name:,
    function_definitions:,
    source_includes:,
    header_includes:,
    c_module:,
    output_path:
  )
  source = @file_path_utils.form_partial_implementation_source_filename(name)
  header = @file_path_utils.form_partial_implementation_header_filename(name)

  header_filepath = File.join(output_path, header)
  source_filepath = File.join(output_path, source)

  @file_wrapper.open(header_filepath, 'w') do |file|
    generate_header(file, header, header_includes, function_definitions, c_module, true)
  end

  @file_wrapper.open(source_filepath, 'w') do |file|
    generate_source(file, source_includes, function_definitions, c_module)
  end

  return source_filepath
end

#generate_interface(test:, name:, function_declarations:, includes:, c_module:, output_path:) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/ceedling/generators/generator_partials.rb', line 42

def generate_interface(test:, name:, function_declarations:, includes:, c_module:, output_path:)
  header = @file_path_utils.form_partial_interface_header_filename(name)
  filepath = File.join(output_path, header)

  @file_wrapper.open(filepath, 'w') do |file|
    generate_header(file, header, includes, function_declarations, c_module, false)
  end

  return filepath
end