Class: SSHKit::Host
- Inherits:
-
Object
- Object
- SSHKit::Host
- Defined in:
- lib/sshkit/docker_host_ext.rb
Instance Attribute Summary collapse
-
#docker_host_id ⇒ Object
Returns the value of attribute docker_host_id.
- #docker_options ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#docker_host_id ⇒ Object
Returns the value of attribute docker_host_id.
5 6 7 |
# File 'lib/sshkit/docker_host_ext.rb', line 5 def docker_host_id @docker_host_id end |
#docker_options ⇒ Object
11 12 13 |
# File 'lib/sshkit/docker_host_ext.rb', line 11 def ||= {} end |
Instance Method Details
#docker=(hash) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sshkit/docker_host_ext.rb', line 15 def docker=(hash) @docker_host_id = hash.__id__ @hostname = "(docker " @user ||= 'root' @port = @docker_host_id # Use hash id to ident host by injecting to port .update hash.symbolize_keys if .has_key?(:image) @hostname << "image: #{@docker_options[:image]})" elsif .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
7 8 9 |
# File 'lib/sshkit/docker_host_ext.rb', line 7 def docker? !.empty? end |