Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/configurable/core_ext/inflections.rb

Overview

Define some simplified inflection methods on String if they’re not already defined. Code adapted from Rails’ ActiveSupport.

Instance Method Summary collapse

Instance Method Details

#camelizeObject

Turns a_string_like_this into AStringLikeThis.



6
7
8
# File 'lib/configurable/core_ext/inflections.rb', line 6

def camelize
  self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end