Why does titleize remove hyphens?

item.title = ‘alpha-bravo’
item.title = item.title.titleize
puts item.title

alpha bravo

I didn’t notice this with 1.0 - a new bug in 1.1?

Joe

item.title = ‘alpha-bravo’
item.title = item.title.titleize
puts item.title

alpha bravo

I didn’t notice this with 1.0 - a new bug in 1.1?

I’d say feature, not bug. Inflector.titleize calls function underscore,
which
translates - to _ and then calls function humanize which converts
underscores to
spaces…

Regards,
Rimantas

http://rimantas.com/

Bleh, bug IMO. I can understand converting underscores to spaces, but
not hyphens. Plus, titleize screws up apostrophes:

JOE’S -> Joe’S

Joe

Submitted (for the apostrophes part, anyway):

http://dev.rubyonrails.org/ticket/4607

Cheers,
David

Thanks!

Joe

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs