Sha256: 58d497b8030f4f1bcde5540ec7f06eb59d6772103a14aa74a79a362ba2b20df0
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# encoding: utf-8 class String ACCENTS_MAPPING = [ {letter: 'A', upcase: 'ÁÀÄÂ', downcase: 'áàäâ'}, {letter: 'E', upcase: 'ÉÈËÊ', downcase: 'éèëê'}, {letter: 'I', upcase: 'ÍÌÏÎ', downcase: 'íìïî'}, {letter: 'O', upcase: 'ÓÒÖÔ', downcase: 'óòöô'}, {letter: 'U', upcase: 'ÚÙÜÛ', downcase: 'úùüû'} ] alias_method :upcase_ignoring_accents!, :upcase! def upcase! ACCENTS_MAPPING.each { |map| tr! map[:downcase], map[:upcase] } upcase_ignoring_accents! end def upcase self.dup.upcase! end alias_method :downcase_ignoring_accents!, :downcase! def downcase! ACCENTS_MAPPING.each { |map| tr! map[:upcase], map[:downcase] } downcase_ignoring_accents! end def downcase self.dup.downcase! end def unaccented! ACCENTS_MAPPING.each do |map| tr! map[:upcase], map[:letter] tr! map[:downcase], map[:letter].downcase end self end def unaccented self.dup.unaccented! end def normalized! self.unaccented!.downcase! end def normalized self.dup.normalized! end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
core_extended-0.0.1 | lib/core_extended/string.rb |