Included Modules

Docker::Base

This class is a base class for Docker Container and Image. It is implementing accessor methods for the models attributes.

Attributes

connection[RW]
id[R]
info[RW]

Public Class Methods

new(connection, hash={}) click to toggle source

The private new method accepts a connection and optional id.

# File lib/docker/base.rb, line 10
def initialize(connection, hash={})
  unless connection.is_a?(Docker::Connection)
    raise ArgumentError, "Expected a Docker::Connection, got: #{connection}."
  end
  normalize_hash(hash)
  @connection, @info, @id = connection, hash, hash['id']
  raise ArgumentError, "Must have id, got: #{hash}" unless @id
end

Public Instance Methods

normalize_hash(hash) click to toggle source

The docker-api will some time return "ID" other times it will return "Id" and other times it will return "id". This method normalize it to "id"

# File lib/docker/base.rb, line 21
def normalize_hash(hash)
  hash["id"] ||= hash.delete("ID") || hash.delete("Id")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.