Module: Spurious::Server::State::Factory

Defined in:
lib/spurious/server/state/factory.rb

Class Method Summary collapse

Class Method Details

.create(type, connection, config, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/spurious/server/state/factory.rb', line 13

def self.create(type, connection, config, options = {})
  case type.to_sym
  when :init
    Init.new(connection, config, options.docker_host)
  when :start
    Start.new(connection, config, options.docker_host)
  when :stop
    Stop.new(connection, config)
  when :ports
    Ports.new(connection, config, options.docker_host)
  when :delete
    Delete.new(connection, config)
  when :error
    Error.new(connection)
  else
    Error.new(connection, "Type: #{type} is not recognised")
  end
end