Module: JerbilService::Utils
- Defined in:
- lib/jerbil/jerbil_service/utils.rb
Overview
misc. methods for Jerbil scripts
Class Method Summary collapse
-
.classify(string) ⇒ String
convert a filename etc to a proper class name For example, converts ‘my_service’ to ‘MyService’.
Class Method Details
.classify(string) ⇒ String
convert a filename etc to a proper class name For example, converts ‘my_service’ to ‘MyService’
29 30 31 32 |
# File 'lib/jerbil/jerbil_service/utils.rb', line 29 def Utils.classify(string) string = string.sub(/^[a-z\d]*/) { $&.capitalize } string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::') end |