Skip to content

Instantly share code, notes, and snippets.

@taktran
Created November 23, 2011 14:04
Show Gist options
  • Save taktran/1388735 to your computer and use it in GitHub Desktop.
Save taktran/1388735 to your computer and use it in GitHub Desktop.
Ruby for converting a string to a css class
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