Sha256: 9ac7244a9fd14f42c07cf7b5fd56e0843ef3becde7423dff3da2663dd0c88ac8

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

require 'fog/core'

module Fog
  module Vsphere
    extend Fog::Provider

    module Errors
      class ServiceError < Fog::Errors::Error; end
      class SecurityError < ServiceError; end
      class NotFound < ServiceError; end
    end

    service(:compute, 'Compute')

    # This helper was originally added as Fog.class_as_string and moved to core but only used here
    def self.class_from_string classname, defaultpath=""
      if classname and classname.is_a? String then
        chain = classname.split("::")
        klass = Kernel
        chain.each do |klass_string|
          klass = klass.const_get klass_string
        end
        if klass.is_a? Class then
          klass
        elsif defaultpath != nil then
          class_from_string((defaultpath.split("::")+chain).join("::"), nil)
        else
          nil
        end
      elsif classname and classname.is_a? Class then
        classname
      else
        nil
      end
    rescue NameError
      defaultpath != nil ? class_from_string((defaultpath.split("::")+chain).join("::"), nil) : nil
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
fog-1.36.0 lib/fog/vsphere/core.rb
fog-1.35.0 lib/fog/vsphere/core.rb
fog-2.0.0.pre.0 lib/fog/vsphere/core.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/vsphere/core.rb
fog-1.34.0 lib/fog/vsphere/core.rb
fog-1.33.0 lib/fog/vsphere/core.rb
fog-1.32.0 lib/fog/vsphere/core.rb
fog-1.31.0 lib/fog/vsphere/core.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/vsphere/core.rb
fog-1.30.0 lib/fog/vsphere/core.rb
fog-1.29.0 lib/fog/vsphere/core.rb
fog-1.28.0 lib/fog/vsphere/core.rb
fog-1.27.0 lib/fog/vsphere/core.rb
fog-1.26.0 lib/fog/vsphere/core.rb
fog-1.25.0 lib/fog/vsphere/core.rb
nsidc-fog-1.24.1 lib/fog/vsphere/core.rb
fog-1.24.0 lib/fog/vsphere/core.rb
ns-fog-1.22.11 lib/fog/vsphere/core.rb
ns-fog-1.22.10 lib/fog/vsphere/core.rb
ns-fog-1.22.9 lib/fog/vsphere/core.rb