module Aquarium::Utils::CamelCase

Public Instance Methods

to_camel_case(str) click to toggle source
  # File lib/aquarium/utils/camel_case.rb
4 def to_camel_case str
5   str.split('_').map {|s| s[0,1]=s[0,1].capitalize; s}.join
6 end
to_snake_case(str) click to toggle source
   # File lib/aquarium/utils/camel_case.rb
 8 def to_snake_case str
 9   str.gsub(/([A-Z]+[a-z0-9_-]*)/, '\1_').downcase.gsub(/__*/, '_').gsub(/_$/, '').gsub(/^_/, '')
10 end