Created
          April 27, 2011 15:55 
        
      - 
      
 - 
        
Save ahoward/944532 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
ahoward revised this gist
Apr 27, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ compile = proc{|w| a, b = w[0..0], w[1..-1]; /^\s*#{ a }(?:#{ b })?\s*$/i} MalePatterns = %w( man male boy ). map(&compile)  - 
        
ahoward created this gist
Apr 27, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ MalePatterns = %w( man male boy ). map(&compile) FemalePatterns = %w( woman female girl ). map(&compile) def normalize_gender! gender = case self.gender.to_s when *MalePatterns 'm' when *FemalePatterns 'f' end self.gender = gender end