Class: Kitchen::Docker::ERBContext

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/docker/erb_context.rb

Overview

Evaluation context for a user-supplied Dockerfile template.

Each configuration key becomes an instance variable, so a template can refer to @image, @username, and the rest.

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ERBContext

Exposes each config key to the template as an instance variable, so a custom Dockerfile can refer to @image, @username, and the rest.

Parameters:

  • config (Hash) (defaults to: {})

    the configuration to expose



29
30
31
32
33
# File 'lib/kitchen/docker/erb_context.rb', line 29

def initialize(config = {})
  config.each do |key, value|
    instance_variable_set("@" + key.to_s, value)
  end
end

Instance Method Details

#get_bindingBinding

Returns a binding for ERB to evaluate the template in.

Returns:

  • (Binding)

    a binding for ERB to evaluate the template in



36
37
38
# File 'lib/kitchen/docker/erb_context.rb', line 36

def get_binding
  binding
end