Module: Gyoku::CoreExt::String
- Defined in:
- lib/gyoku/core_ext/string.rb
Instance Method Summary collapse
-
#camelcase ⇒ Object
Returns the String in CamelCase.
-
#lower_camelcase ⇒ Object
Returns the String in lowerCamelCase.
Instance Method Details
#camelcase ⇒ Object
Returns the String in CamelCase.
11 12 13 |
# File 'lib/gyoku/core_ext/string.rb', line 11 def camelcase self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end |
#lower_camelcase ⇒ Object
Returns the String in lowerCamelCase.
6 7 8 |
# File 'lib/gyoku/core_ext/string.rb', line 6 def lower_camelcase self[0].chr.downcase + self.camelcase[1..-1] end |