Skip to content

Use $stderr.printf with double-quoted format strings in examples - #580

Open
pattersonlois wants to merge 2 commits into
googleads:mainfrom
pattersonlois:fix-stderr-printf-single-quotes
Open

pattersonlois wants to merge 2 commits into
googleads:mainfrom
pattersonlois:fix-stderr-printf-single-quotes

Conversation

@pattersonlois

@pattersonlois pattersonlois commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

In Ruby, single-quoted string literals do not interpret \n or \t escape sequences, and IO#printf only expands % format directives. As a result, passing '...\n' and '\t...' to printf in the GoogleAdsError rescue block prints literal \n and \t characters on a single line without a trailing newline.

Updates the three affected examples to use $stderr.printf (Style/GlobalStdStream) with double-quoted format strings, matching recent examples in examples/:

  • examples/basic_operations/update_responsive_search_ad.rb
  • examples/misc/set_custom_client_timeouts.rb
  • examples/misc/upload_image_asset.rb

@pattersonlois
pattersonlois requested review from a team as code owners November 23, 2026 20:26
@pattersonlois
pattersonlois requested review from AnashOommen and bobhancockg and removed request for a team November 23, 2026 20:26
bobhancockg
bobhancockg previously approved these changes Nov 23, 2026
@pattersonlois pattersonlois changed the title Use double quotes for STDERR.printf escape sequences in examples Use $stderr.printf with double-quoted format strings in examples Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants