A small service collects a summary of events and stores it in an arbitrary sink. In the normal scenario, it should pass through only valid records, and when it fails it must propagate the original error outward.
EventExporter#export method accepts enumerable events and sink:.sink.write(line) is called."#{type}:#{payload}", where type and payload are taken from the event hash.{:type => String, :payload => String} pattern, it is skipped.sink.write or any other part of processing fails, the method must finish with that same error, without substituting another exception type.export and compare the behavior with the expected one.Input example:
events = [
{type: "order", payload: "created"},
{type: :skip, payload: "ignored"},
{type: "order", payload: "failed"}
]
sink.write is not lost and is not replaced by a partial result.ruby from the command line, without additional gemsUse line comments to explain the problem, its impact, the fix and how to test it.