Class: String
- Inherits:
-
Object
- Object
- String
- 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
-
#camelize ⇒ Object
Turns a_string_like_this into AStringLikeThis.
Instance Method Details
#camelize ⇒ Object
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 |