Class: ActionTexter::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/action_texter/helper.rb

Class Method Summary collapse

Class Method Details

.underscore(camel_cased_word) ⇒ Object



3
4
5
6
7
8
# File 'lib/action_texter/helper.rb', line 3

def self.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