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

#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.


214
215
216
217
218
# File 'lib/rumrunner/docker.rb', line 214

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:


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

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.


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

attr_method_accessor :image, :cmd