Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8533

Show
Ignore:
Timestamp:
01/03/08 00:16:47 (6 months ago)
Author:
david
Message:

Fixed String#titleize to work for strings with 's too (closes #10571) [trek]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r8523 r8533  
    11*SVN* 
     2 
     3* Fixed String#titleize to work for strings with 's too #10571 [trek] 
    24 
    35* 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] 
  • trunk/activesupport/lib/active_support/inflector.rb

    r7569 r8533  
    163163  #   "x-men: the last stand".titleize #=> "X Men: The Last Stand" 
    164164  def titleize(word) 
    165     humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } 
     165    humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize } 
    166166  end 
    167167 
  • trunk/activesupport/test/inflector_test_cases.rb

    r7655 r8533  
    156156    'Action web service'  => 'Action Web Service', 
    157157    'actionwebservice'    => 'Actionwebservice', 
    158     'Actionwebservice'    => 'Actionwebservice' 
     158    'Actionwebservice'    => 'Actionwebservice', 
     159    "david's code"        => "David's Code", 
     160    "David's code"        => "David's Code", 
     161    "david's Code"        => "David's Code" 
    159162  } 
    160163