Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/fog/softlayer/compute.rb
Overview
some helpers for some dirty work
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
171 172 173 |
# File 'lib/fog/softlayer/compute.rb', line 171 def camelize self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join end |
#underscore ⇒ Object
175 176 177 178 179 180 181 |
# File 'lib/fog/softlayer/compute.rb', line 175 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |