Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/hw/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#to_pkgObject



2
3
4
5
# File 'lib/hw/core_ext/string.rb', line 2

def to_pkg
  string = self.to_s.sub(/^[a-z\d]*/) { $&.capitalize }
  string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
end