class Axl::Utils::String
Public Class Methods
camelize(str)
click to toggle source
# File lib/axl/utils/string.rb, line 9 def camelize(str) word = str.slice(0,1).capitalize + str.slice(1..-1) word.gsub(/_([a-zA-Z\d])/) { "#{$1.capitalize}" } end
constantize(str)
click to toggle source
# File lib/axl/utils/string.rb, line 14 def constantize(str) str.split("::").inject(Object) do |namespace, sym| namespace.const_get(self.camelize(sym.to_s), false) end end
underscore(str)
click to toggle source
# File lib/axl/utils/string.rb, line 20 def underscore(str) str.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase end