Module: TitleizePTBR

Included in:
String
Defined in:
lib/titleizePTBR.rb,
lib/titleizePTBR/version.rb

Constant Summary collapse

VERSION =
"2.0.0"

Instance Method Summary collapse

Instance Method Details

#titleize_pt_brObject



4
5
6
7
8
9
10
11
12
# File 'lib/titleizePTBR.rb', line 4

def titleize_pt_br
    downcase.gsub(/\b('?\S)/u) {$1.upcase}.
    gsub(" A ", " a ").
    gsub(" E ", " e ").
    gsub(/ D(e|[ao]s?) /, ' d\1 ').
    gsub(/ N([ao]s?) /, ' n\1 ').
    gsub(/ Com /, " com ").
    gsub(" Em ", " em ")
end