Summary
The documented add_language(...) call with a braceless string-keyed hash raises ArgumentError, so the primary getting-started example fails. Fix the docs/examples now; harden the method so the call can't blow up.
Where
Docs/examples — README.md (first agent block), examples/simple_agent.rb and any other example (grep add_language('). Code — lib/signalwire/agent/agent_base.rb, method add_language (grep def add_language).
Reproduce
# In a script: agent.add_language('name' => 'English', 'code' => 'en-US', 'voice' => 'x')
# => ArgumentError: wrong number of arguments (given 0, expected 1..3)
Root cause
add_language mixes positional and keyword parameters; a braceless string-keyed hash is parsed as keyword args, leaving zero positional args.
Directive
- Docs (do first): wrap the hash in braces —
add_language({ 'name' => 'English', ... }) — or use the positional form, everywhere it appears.
- Code (hardening): accept the braceless/keyword-style payload and route it to the existing config-hash overload, preserving the positional + keyword behavior and byte-identical SWML.
Guardrails
Do not change emitted SWML bytes for existing valid calls. The code change must keep add_language's public arity/behavior for current callers.
Acceptance
Verify
Run each touched example with a 3.2+ Ruby · bundle exec ruby -Ilib:tests tests/agent_test.rb · bundle exec rubocop on changed files.
Summary
The documented
add_language(...)call with a braceless string-keyed hash raisesArgumentError, so the primary getting-started example fails. Fix the docs/examples now; harden the method so the call can't blow up.Where
Docs/examples —
README.md(first agent block),examples/simple_agent.rband any other example (grepadd_language('). Code —lib/signalwire/agent/agent_base.rb, methodadd_language(grepdef add_language).Reproduce
Root cause
add_languagemixes positional and keyword parameters; a braceless string-keyed hash is parsed as keyword args, leaving zero positional args.Directive
add_language({ 'name' => 'English', ... })— or use the positional form, everywhere it appears.Guardrails
Do not change emitted SWML bytes for existing valid calls. The code change must keep
add_language's public arity/behavior for current callers.Acceptance
grep -rn "add_language('" README.md examples/finds no braceless string-keyed callsVerify
Run each touched example with a 3.2+ Ruby ·
bundle exec ruby -Ilib:tests tests/agent_test.rb·bundle exec rubocopon changed files.