Class: Faccts::RustCodeGenerator::RustNameToFunctionCallConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/faccts/03_generating_code/rust_name_to_function_call_converter.rb

Defined Under Namespace

Classes: InvalidNameError, RustCharacterConverter

Instance Method Summary collapse

Constructor Details

#initializeRustNameToFunctionCallConverter

Returns a new instance of RustNameToFunctionCallConverter.



6
7
8
# File 'lib/faccts/03_generating_code/rust_name_to_function_call_converter.rb', line 6

def initialize
  @character_converter = RustCharacterConverter.new
end

Instance Method Details

#convert!(test_assertion) ⇒ Object

Raises:



10
11
12
13
14
15
16
17
18
19
# File 'lib/faccts/03_generating_code/rust_name_to_function_call_converter.rb', line 10

def convert!(test_assertion)
  @action_name = test_assertion.action_name
  @arguments = test_assertion.arguments || []

  converted_name = converted_characters(stripped_action_name)

  raise InvalidNameError if all_characters_were_removed?(converted_name)

  "#{converted_name}(#{converted_arguments})"
end