Created
          August 30, 2010 03:46 
        
      - 
      
 - 
        
Save joshcutler/556994 to your computer and use it in GitHub Desktop.  
    Ruby snippet to simulate nl2br
  
        
  
    
      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 characters
    
  
  
    
  | def nl2br(string) | |
| if string | |
| string.gsub("\n\r","<br />").gsub("\r", "").gsub("\n", "<br />") | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Ruby snippet to simulate nl2br