Skip to content

Wrap multibyte split results without removed String extensions - #1677

Open
OskarEichler wants to merge 1 commit into
mikel:masterfrom
OskarEichler:codex/split-mail
Open

OskarEichler wants to merge 1 commit into
mikel:masterfrom
OskarEichler:codex/split-mail

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Wrap split pieces through the existing chars helper instead of calling the removed String#mb_chars extension. The documented split example currently raises NoMethodError without ActiveSupport.

Reproduction

require 'mail'
chars = Mail::Multibyte::Chars.new('Café périferôl')
p chars.split(/é/).map { |part| part.upcase.to_s }
# => ["CAF", " P", "RIFERÔL"]

Verification

  • Existing bundle exec rake spec: 1,837 examples, zero failures, four existing pending, before and after this isolated patch on Ruby 4.0.6 via rbenv.
  • 145 focused checks, 81 baseline failures → zero: whitespace/string/regexp separators, empty inputs, positive/negative limits, Unicode, original input ownership and subclass return types. Existing Remove core_extensions from mail when running Ruby > 2.0 #1095 removed core String extensions; this remaining call was not replaced. No internal split callers found, so this restores a public helper without claiming a production throughput improvement.
  • Targeted syntax and git diff --check pass; supplementary Lint retains 275 existing findings by file/cop/message.

Limitations and contribution policy

CONTRIBUTING.md and relevant source/specs were reviewed; a changelog entry is included. The requesting project’s explicit no-new-tests policy prevents repository spec additions/edits. This differs from upstream’s regression-spec request; runnable reproduction and external verification are supplied, and maintainer follow-up may be needed. Other Ruby versions/engines and production are unverified. An external bundle supplies the consumer’s patched network/mini_mime dependencies and benchmark for Ruby 4; no dependency upgrades or CI changes in this PR.

Breaking changes

No API signatures change. Results remain an array of character wrappers, now preserving the receiver class through the existing helper. This no longer depends on a globally added String#mb_chars implementation.

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