Method: App42::Base::Util#camel_case_to_whitespace
- Defined in:
- lib/app42/base/util.rb
#camel_case_to_whitespace(str) ⇒ Object
camel case to whitespace
258 259 260 261 262 263 264 265 266 |
# File 'lib/app42/base/util.rb', line 258 def camel_case_to_whitespace str str_cap = str.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_").downcase str_capitalize = str_cap.tr("_", " ").capitalize str_capitalize.split(' ').map(&:capitalize).join(' ') end |