Module: Fog::Provider

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



13
14
15
16
# File 'lib/rackspace-fog/core/provider.rb', line 13

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

Instance Method Details

#[](service_key) ⇒ Object



18
19
20
# File 'lib/rackspace-fog/core/provider.rb', line 18

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

#service(new_service, path, constant_string) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/rackspace-fog/core/provider.rb', line 22

def service(new_service, path, 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('::')
  require File.join('rackspace-fog', path)
end

#servicesObject



30
31
32
# File 'lib/rackspace-fog/core/provider.rb', line 30

def services
  @services_registry.keys
end