Class: Fog::NewServers::Compute::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/compute/new_servers.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/compute/new_servers.rb', line 34

def initialize(options={})
  unless options.delete(:provider)
    location = caller.first
    warning = "[yellow][WARN] Fog::NewServers::Compute.new is deprecated, use Fog::Compute.new(:provider => 'NewServers') instead[/]"
    warning << " [light_black](" << location << ")[/] "
    Formatador.display_line(warning)
  end

  @new_server_username = options[:new_servers_username]
  @data = self.class.data[@new_server_username]
end

Class Method Details

.dataObject



22
23
24
25
26
# File 'lib/fog/compute/new_servers.rb', line 22

def self.data
  @data ||= Hash.new do |hash, key|
    hash[key] = {}
  end
end

.reset_data(keys = data.keys) ⇒ Object



28
29
30
31
32
# File 'lib/fog/compute/new_servers.rb', line 28

def self.reset_data(keys=data.keys)
  for key in [*keys]
    data.delete(key)
  end
end