Sha256: 6fa96e9d4867e56f2bdb5532e4f955d445137cbb8a2634296ef5cc1e9e2679ef

Contents?: true

Size: 727 Bytes

Versions: 8

Compression:

Stored size: 727 Bytes

Contents

module Fog

  def self.providers
    @providers ||= {}
  end

  def self.providers=(new_providers)
    @providers = new_providers
  end

  module Provider

    def self.extended(base)
      provider = base.to_s.split('::').last
      Fog.providers[provider.downcase.to_sym] = provider
    end

    def [](service_key)
      eval(@services_registry[service_key]).new
    end

    def service(new_service, constant_string)
      Fog.services[new_service] ||= []
      Fog.services[new_service] |= [self.to_s.split('::').last.downcase.to_sym]
      @services_registry ||= {}
      @services_registry[new_service] = [self.to_s, constant_string].join('::')
    end

    def services
      @services_registry.keys
    end

  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
fog-core-1.24.0 lib/fog/core/provider.rb
fog-core-1.23.0 lib/fog/core/provider.rb
fog-core-1.22.0 lib/fog/core/provider.rb
fog-core-1.21.1 lib/fog/core/provider.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/core/provider.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/core/provider.rb
fog-core-1.21.0 lib/fog/core/provider.rb
fog-1.20.0 lib/fog/core/provider.rb