Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/string.rb,
lib/html5/filters/validator.rb

Instance Method Summary collapse

Instance Method Details

#underscoreObject

lifted from rails



24
25
26
27
28
29
30
# File 'lib/html5/filters/validator.rb', line 24

def underscore()
  self.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-", "_").
    downcase
end