Module: CarefulTitleize
- Defined in:
- app/lib/careful_titleize.rb
Instance Method Summary collapse
Instance Method Details
#careful_titleize ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/lib/careful_titleize.rb', line 2 def careful_titleize # Regex here is from ActiveSupport::Inflector#titleize, but we remove # a lot of the preprocessing which discards stuff we want to keep gsub(/[_-]/, " ").gsub(/\b([[:alnum:]]{1})[[:lower:][:digit:][:punct:]]*\b/) do |match| match.upcase_first end end |