Sha256: 35e38cbce7a1c0149ec4c5f2bac97586f7974bd7e208546deb47d0bd82b38466

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

module CloudstackClient
  module Utils

    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

    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

    def print_debug_output(output, seperator = '-' * 80)
      puts
      puts seperator
      puts output
      puts seperator
      puts
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cloudstack_client-1.4.0 lib/cloudstack_client/utils.rb
cloudstack_client-1.3.1 lib/cloudstack_client/utils.rb