mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed String#titleize to work for strings with 's too (closes #10571) [trek]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
f5aaf945b6
commit
3229b59495
3 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed String#titleize to work for strings with 's too #10571 [trek]
|
||||
|
||||
* Changed the implementation of Enumerable#group_by to use a double array approach instead of a hash such that the insert order is honored [DHH/Marcel]
|
||||
|
||||
* remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml when dealing with date/time values. [rick]
|
||||
|
|
|
@ -162,7 +162,7 @@ module Inflector
|
|||
# "man from the boondocks".titleize #=> "Man From The Boondocks"
|
||||
# "x-men: the last stand".titleize #=> "X Men: The Last Stand"
|
||||
def titleize(word)
|
||||
humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize }
|
||||
humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize }
|
||||
end
|
||||
|
||||
# The reverse of +camelize+. Makes an underscored form from the expression in the string.
|
||||
|
|
|
@ -155,7 +155,10 @@ module InflectorTestCases
|
|||
'Action Web Service' => 'Action Web Service',
|
||||
'Action web service' => 'Action Web Service',
|
||||
'actionwebservice' => 'Actionwebservice',
|
||||
'Actionwebservice' => 'Actionwebservice'
|
||||
'Actionwebservice' => 'Actionwebservice',
|
||||
"david's code" => "David's Code",
|
||||
"David's code" => "David's Code",
|
||||
"david's Code" => "David's Code"
|
||||
}
|
||||
|
||||
OrdinalNumbers = {
|
||||
|
|
Loading…
Reference in a new issue