mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 12:12:21 -05:00
10 lines
325 B
Ruby
10 lines
325 B
Ruby
module CarefulTitleize
|
|
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
|
|
end
|