Skip to content

Correct encoding examples, padding lengths and decoder alphabet documentation - #68

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/documentation-base64
Open

Correct encoding examples, padding lengths and decoder alphabet documentation#68
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/documentation-base64

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Correct the Base64 documentation's encoded values, newline lengths, padding explanations, and accepted alphabets. Regenerate the corresponding RBS documentation with the existing rbs:annotate task. No runtime implementation or type signatures change.

Reproduction

Current documentation says Base64.strict_encode64('123') returns "MDEy", but it returns "MTIz". The same shifted input affects twelve examples. Base64.encode64("\x00").size is 5, not 4, because the newline counts toward the length.

The unpadded-output sections incorrectly describe trailing padding, and the decoder overview incorrectly says every decoder accepts missing padding. / belongs to the standard alphabet. URL-safe decoding also accepts the standard alphabet (and mixed alphabets), so testing a single + or / demonstrates an invalid length rather than an alphabet restriction.

Verification

Using Ruby 4.0.6 through rbenv:

  • Existing rake test: 9 tests, 73 assertions, no failures/errors.
  • Existing rake rbs:test: 6 tests, 35 assertions, no failures/errors.
  • External, uncommitted verification: 2,636 checks, including 70 documented examples and frozen-input round trips for input lengths 0–512.
  • Runtime token comparison against the base revision: unchanged.
  • rake rbs:annotate, Ruby syntax check, gem build, and git diff --check pass. Gem build retains the existing metadata warnings.

No tests were added or modified, per the requesting project's contribution constraint. Verification was local on macOS/Ruby 4.0.6; the full supported Ruby/OS matrix was not run locally. Existing documentation fixes already on main, including #46's signature comments, are not duplicated.

Breaking changes

None. This changes documentation only; accepted input, output, signatures, dependencies, and version are unchanged.

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.

1 participant