Module: Clinical::Extensions::String
- Defined in:
- lib/clinical/extensions.rb
Instance Method Summary collapse
Instance Method Details
#underscore(camel_cased_word) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/clinical/extensions.rb', line 12 def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |