HLFH / namelib

Ruby gem that properly cases your clients' names
GNU General Public License v3.0
1 stars 1 forks source link

Repeated "Mc" prefix leads to incorrect duplication #2

Open HLFH opened 7 years ago

HLFH commented 7 years ago

@aprescott

I'm not sure if this is actually a bug, given possible real-world inputs, but it certainly seems wrong.

> NameCase("mcfoo mcbar")
=> "McFoo McFoo"
> NameCase("MCFOO MCBAR")
=> "McFoo McFoo"

The "McBar" has been clobbered by "McFoo" because the replacement is global across the whole string. This gem seems to support passing a full first+last name input, so this looks like a bug to me. Note this working case, though:

> NameCase("McFoo McBar")
=> "McFoo McBar"
aprescott commented 7 years ago

I was confused why I was @-mentioned here, but for posterity I see this is a copy of https://github.com/tenderlove/namecase/issues/9.