Module: Dockerspec::Helper::MultipleSourcesDescription

Included in:
Builder, Runner
Defined in:
lib/dockerspec/helper/multiple_sources_description.rb

Overview

Methods to generate the correct object description for objects that has a source attribute.

Shortens the docker IDs automatically.

Requirements:

  • source method: Returns the source you are using to generating your object.
  • :@options attribute: The options array with the configuration options, including the source.

Used by the Builder and Runner classes.

Instance Method Summary collapse

Instance Method Details

#description(prefix) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Generates a description of the object.

Examples:

self.description('Docker Build from')
  #=> "Docker Build from path: \".\""

Parameters:

  • prefix (String)

    The prefix to add to the description.

Returns:

  • (String)

    The object description.



61
62
63
64
65
# File 'lib/dockerspec/helper/multiple_sources_description.rb', line 61

def description(prefix)
  value = @options[source]
  desc = send("description_from_#{source}", value)
  "#{prefix} #{source.to_s.tr('_', ' ')}: \"#{desc}\""
end