Class: Dort::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/dort.rb

Defined Under Namespace

Classes: Expose, Ports

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Container

Returns a new instance of Container.



43
44
45
46
47
48
49
# File 'lib/dort.rb', line 43

def initialize(data)
  @data = data
  @id = @data['Id'][0..11]
  @name = @data['Name']
  @ports = Ports.new @data['HostConfig']['PortBindings'] || []
  @expose = Expose.new @data['Config']['ExposedPorts'] || []
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



41
42
43
# File 'lib/dort.rb', line 41

def data
  @data
end

#exposeObject (readonly)

Returns the value of attribute expose.



41
42
43
# File 'lib/dort.rb', line 41

def expose
  @expose
end

#idObject (readonly)

Returns the value of attribute id.



41
42
43
# File 'lib/dort.rb', line 41

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/dort.rb', line 41

def name
  @name
end

#portsObject (readonly)

Returns the value of attribute ports.



41
42
43
# File 'lib/dort.rb', line 41

def ports
  @ports
end

Instance Method Details

#to_sObject Also known as: inspect



51
52
53
# File 'lib/dort.rb', line 51

def to_s
  "#<#{self.class}:#{object_id} Id=#{id} Name=#{name}>"
end