A small service collects a short summary of input parameters for the log. In some calls the result looks almost correct, but individual fields end up empty or moved to another place.
ParamSummary.build method accepts:
event_name;user:, source:, and details:;meta: with a hash of additional fields.Hash with the following keys:
:event_name — a string;:user — a string;:source — a string;:details — a string;:meta — a hash of additional fields.details: is not provided, it must become an empty string.meta: is not provided, :meta must be an empty hash.require_relative "param_summary"
first = ParamSummary.build("signup", user: "ann", source: "api", meta: { region: "eu" })
second = ParamSummary.build("login", user: "bob", source: "ui", details: "retry")
p first
p second
:details and :meta with the expected ones.:details should be "", and :meta should be { region: "eu" }.:details should be "retry", and :meta should be {}.ruby -I. param_summary_demo.rbUse line comments to explain the problem, its impact, the fix and how to test it.