fix(encoder): replace values_at with string slicing to avoid latent nil#73
fix(encoder): replace values_at with string slicing to avoid latent nil#73matteoredz wants to merge 1 commit into
Conversation
values_at(0, 2..consonants.size) silently returns nil for the out-of-bounds index and join discards it, producing the correct result by accident. Replace with the explicit string-slice idiom, which is Ruby 2.5-safe and expresses the intent clearly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 59 minutes and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
encode_nameusedconsonants.chars.values_at(0, 2..consonants.size).jointo skip the 2nd consonant when a name has more than 3 consonants.2..consonants.sizeexceeds valid indices by 1;Array#values_atreturnsnilfor the out-of-bounds index, whichjoinsilently discards — producing correct output by accident.(consonants[0] + consonants[2..-1]).to_s, which is explicit, nil-free, and Ruby 2.5-safe.Test plan
bundle exec rakegreen with 100% line + branch coveragebundle exec rubocopclean on changed files🤖 Generated with Claude Code