Module: Todo::Helpers::String::Camelize
Instance Method Summary collapse
Instance Method Details
#camelize(string) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/todo/helpers/string/camelize.rb', line 5 def camelize(string) string.to_s. sub(/^[a-z\d]*/) { $&.capitalize }. gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }. gsub('/', '::') end |