Module: Rum::Docker::Executable

Includes:
Enumerable
Included in:
Build, Run
Defined in:
lib/rumrunner/docker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



35
36
37
38
# File 'lib/rumrunner/docker.rb', line 35

def method_missing(m, *args, &block)
  @options.send(m, *args, &block)
  args.any? ? self : @options[m]
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



23
24
25
# File 'lib/rumrunner/docker.rb', line 23

def options
  @options
end

Instance Method Details

#eachObject



30
31
32
33
# File 'lib/rumrunner/docker.rb', line 30

def each
  self.class.name.split(/::/)[1..-1].each{|x| yield x.downcase }
  @options.each{|x| yield x }
end

#initialize(options: nil, &block) ⇒ Object



25
26
27
28
# File 'lib/rumrunner/docker.rb', line 25

def initialize(options:nil, &block)
  @options = options || Options.new
  instance_eval(&block) if block_given?
end

#to_sObject



40
41
42
# File 'lib/rumrunner/docker.rb', line 40

def to_s
  to_a.join(" ")
end

#with_defaults(options = {}, &block) ⇒ Object



44
45
46
47
# File 'lib/rumrunner/docker.rb', line 44

def with_defaults(options = {}, &block)
  options.reject{|k,v| @options.include? k }.each{|k,v| @options[k] << v }
  self
end