Class: SSHKit::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/sshkit/docker_host_ext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#docker_optionsObject



10
11
12
# File 'lib/sshkit/docker_host_ext.rb', line 10

def docker_options
  @docker_options ||= {}
end

Instance Method Details

#docker=(hash) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sshkit/docker_host_ext.rb', line 14

def docker=(hash)
  @hostname = "(docker "
  @user ||= 'root'
  docker_options.update hash.symbolize_keys
  if docker_options.has_key?(:image)
    @hostname << "image: #{@docker_options[:image]})"
  elsif @docker_options.has_key?(:container)
    @hostname << "container: #{@docker_options[:container]})"
  else
    raise ArgumentError, "Please specify image or container for docker! (ex; docker: {image: 'ruby:2.2'})"
  end
end

#docker?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/sshkit/docker_host_ext.rb', line 6

def docker?
  !docker_options.empty?
end