Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/fog/softlayer/dns.rb,
lib/fog/softlayer/compute.rb,
lib/fog/softlayer/ext/string.rb
Overview
some helpers for some dirty work
Instance Method Summary collapse
Instance Method Details
#fix_convention_exceptions ⇒ Object
7 8 9 10 11 |
# File 'lib/fog/softlayer/ext/string.rb', line 7 def fix_convention_exceptions # SLAPI WHY U No Follow Own Convention!? self.gsub!(/ipaddress/i, 'IpAddress') self.gsub!(/loadbalancer/i, 'LoadBalancer') end |
#softlayer_camelize ⇒ Object
151 152 153 |
# File 'lib/fog/softlayer/dns.rb', line 151 def softlayer_camelize self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join end |
#softlayer_underscore ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/fog/softlayer/dns.rb', line 155 def softlayer_underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |