Class: Rum::Docker::Run

Inherits:
Object
  • Object
show all
Extended by:
AttrCallable
Includes:
Executable
Defined in:
lib/rumrunner/docker.rb

Overview

Docker run command object.

Instance Attribute Summary

Attributes included from Executable

#options

Instance Method Summary collapse

Methods included from AttrCallable

attr_method_accessor

Methods included from Executable

#clear_options, #method_missing, #to_s, #with_defaults

Constructor Details

#initialize(options: nil, image: nil, cmd: nil, &block) ⇒ Run

Initialize Docker run command with OPTIONS, IMAGE, and CMD. Evaluates the &block if given.



221
222
223
224
225
# File 'lib/rumrunner/docker.rb', line 221

def initialize(options:nil, image:nil, cmd:nil, &block)
  @image = image
  @cmd   = cmd
  super options: options, &block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rum::Docker::Executable

Instance Method Details

#each {|@image| ... } ⇒ Object

Yield the Docker run commmand word-by-word.

Yields:



229
230
231
232
233
# File 'lib/rumrunner/docker.rb', line 229

def each
  super{|x| yield x }
  yield @image
  @cmd.is_a?(Array) ? @cmd.each{|x| yield x } : yield(@cmd) unless @cmd.nil?
end

#imageObject

Access IMAGE and CMD with method.



216
# File 'lib/rumrunner/docker.rb', line 216

attr_method_accessor :image, :cmd