Module: Mailercity::Helper

Included in:
Message
Defined in:
lib/mailercity/helper.rb

Instance Method Summary collapse

Instance Method Details

#underscore(camel_cased_word) ⇒ Object

From activesupport/lib/active_support/inflector/methods.rb, line 77



4
5
6
7
8
9
10
11
12
# File 'lib/mailercity/helper.rb', line 4

def underscore(camel_cased_word)
  word = camel_cased_word.to_s.dup
  word.gsub!(/::/, '/')
  word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
  word.tr!("-", "_")
  word.downcase!
  word
end