Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#camelizeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/ext/string.rb', line 2

def camelize
  return self if self !~ /_/ && self =~ /[A-Z]+.*/
  arr = split('_').map do |e| 
    if ['api', 'isbn', 'asin'].include? e
      e.upcase
    else
      e.capitalize
    end
  end
  arr.join
end