Module: CloudstackClient::Utils
- Included in:
- Api, Client, Connection
- Defined in:
- lib/cloudstack_client/utils.rb
Instance Method Summary collapse
- #camel_case_to_underscore(camel_case) ⇒ Object
- #print_debug_output(output, separator = '-' * 80) ⇒ Object
- #underscore_to_camel_case(underscore) ⇒ Object
Instance Method Details
#camel_case_to_underscore(camel_case) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/cloudstack_client/utils.rb', line 4 def camel_case_to_underscore(camel_case) camel_case.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_").downcase end |
#print_debug_output(output, separator = '-' * 80) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cloudstack_client/utils.rb', line 20 def print_debug_output(output, separator = '-' * 80) puts puts separator puts output puts separator puts end |
#underscore_to_camel_case(underscore) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cloudstack_client/utils.rb', line 11 def underscore_to_camel_case(underscore) if underscore.include? "_" string = underscore.split('_').collect(&:capitalize).join string[0].downcase + string[1..-1] else underscore end end |