Skip to content

Instantly share code, notes, and snippets.

@kirkgo
Last active December 26, 2016 16:28
Show Gist options
  • Select an option

  • Save kirkgo/b587d9baf55e95667595 to your computer and use it in GitHub Desktop.

Select an option

Save kirkgo/b587d9baf55e95667595 to your computer and use it in GitHub Desktop.

Revisions

  1. kirkgo revised this gist Dec 26, 2016. No changes.
  2. Kirk Patrick revised this gist Sep 27, 2011. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions ext_upcase_downcase_method.rb
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,14 @@
    class String
    alias_method :old_upcase, :upcase
    def upcase
    self.gsub( /\303[\240-\277]/ ) do
    |match|
    self.gsub( /\303[\240-\277]/ ) do |match|
    match[0].chr + (match[1] - 040).chr
    end.old_upcase
    end

    alias_method :old_downcase, :downcase
    def downcase
    self.gsub( /\303[\200-\237]/ ) do
    |match|
    self.gsub( /\303[\200-\237]/ ) do |match|
    match[0].chr + (match[1] + 040).chr
    end.old_downcase
    end
  3. Kirk Patrick created this gist Sep 27, 2011.
    17 changes: 17 additions & 0 deletions ext_upcase_downcase_method.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    class String
    alias_method :old_upcase, :upcase
    def upcase
    self.gsub( /\303[\240-\277]/ ) do
    |match|
    match[0].chr + (match[1] - 040).chr
    end.old_upcase
    end

    alias_method :old_downcase, :downcase
    def downcase
    self.gsub( /\303[\200-\237]/ ) do
    |match|
    match[0].chr + (match[1] + 040).chr
    end.old_downcase
    end
    end