DEV: Drop OpenStruct for the context object in services

While using `OpenStruct` is nice, it’s generally not a very good idea as
it usually leads to performance problems.

The `OpenStruct` source code even says basically to avoid it.

Since the context object is crucial in our services, this patch replaces
`OpenStruct` with a custom implementation instead.
This commit is contained in:
Loïc Guitaut
2024-10-03 18:05:45 +02:00
committed by Loïc Guitaut
parent 974a3bfc41
commit 229773e7a8
20 changed files with 145 additions and 143 deletions

View File

@@ -26,7 +26,7 @@ module ServiceMatchers
private
def error_message_with_inspection(message)
inspector = StepsInspector.new(result)
inspector = Service::StepsInspector.new(result)
"#{message}\n\n#{inspector.inspect}\n\n#{inspector.error}"
end
end
@@ -89,7 +89,7 @@ module ServiceMatchers
end
def error_message_with_inspection(message)
inspector = StepsInspector.new(result)
inspector = Service::StepsInspector.new(result)
"#{message}\n\n#{inspector.inspect}\n\n#{inspector.error}"
end
@@ -158,7 +158,7 @@ module ServiceMatchers
end
def inspect_steps(result)
inspector = StepsInspector.new(result)
inspector = Service::StepsInspector.new(result)
puts "Steps:"
puts inspector.inspect
puts "\nFirst error:"