Created
November 23, 2011 14:04
-
-
Save taktran/1388735 to your computer and use it in GitHub Desktop.
Ruby for converting a string to a css class
This file contains 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 get_css_class(str) | |
"class-#{str.downcase.gsub(/\W/, "-")}" if str.present? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment