Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/softlayer/dns.rb,
lib/fog/softlayer/core.rb,
lib/fog/softlayer/compute.rb

Overview

some helpers for some dirty work

Instance Method Summary collapse

Instance Method Details

#camelizeObject



152
153
154
# File 'lib/fog/softlayer/dns.rb', line 152

def camelize
  self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
end

#fix_convention_exceptionsObject



151
152
153
# File 'lib/fog/softlayer/core.rb', line 151

def fix_convention_exceptions
  self.gsub!(/ipaddress/i, 'IpAddress') # SLAPI WHY U No Follow Own Convention!?
end

#underscoreObject



156
157
158
159
160
161
162
# File 'lib/fog/softlayer/dns.rb', line 156

def underscore
  self.gsub(/::/, '/').
      gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
      gsub(/([a-z\d])([A-Z])/,'\1_\2').
      tr("-", "_").
      downcase
end