module Inflectors
Public Instance Methods
to_camelcase()
click to toggle source
# File lib/core_ext/inflectors.rb, line 2 def to_camelcase string = self.to_s.downcase string.include?('_') ? string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { $2.capitalize.to_sym } : string.to_sym end
to_underscore()
click to toggle source
# File lib/core_ext/inflectors.rb, line 7 def to_underscore self.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2').tr('-', '_').downcase end