Given the below example, shouldn't AS be in lowercase?
irb > 'HARRY POTTER E AS RELÍQUIAS DA MORTE: PARTE 2'.titleize_pt_br
=> "Harry Potter e As RelÍquias da Morte: Parte 2"
While I'm not necessary a fan of such chicanery, have you considered an interface like this (untested):
module TitleizePTBR
def self.include(m)
if m.instance_methods.include? :titleize
m.class_eval do
alias :old_titleize :titleize
def titleize(*locale)
locale.first == :pt_BR ? titleize_pt_br : old_titleize # check arity of old_titleize
end
end
end
end
def titleize_pt_br
# ...
end
end
class String
include TitleizePTBR
end
s="surra de bunda"
p s.titleize # Surra De Bunda
p s.titleize(:pt_BR) # Surra de Bunda
Hi, I need to check brazilian portuguese grammar, but I think you are right. And there is an error, there is an accent in the world 'RELÍQUIAS' and it isn't in uppercase. I will study your suggestion. Thanks!
Hi!
Given the below example, shouldn't
AS
be in lowercase?While I'm not necessary a fan of such chicanery, have you considered an interface like this (untested):