Class: Hyperb::Container

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/hyperb/containers/container.rb

Overview

container object

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#camelize, #check_arguments, #downcase_symbolize, #prepare_json, #underscore

Constructor Details

#initialize(attrs = {}) ⇒ Container

Returns a new instance of Container.



12
13
14
15
16
17
# File 'lib/hyperb/containers/container.rb', line 12

def initialize(attrs = {})
  attrs.each do |att, value|
    value = downcase_symbolize(value) if value.is_a?(Hash)
    instance_variable_set("@#{att.downcase.to_sym}", value)
  end
end

Instance Attribute Details

#command ⇒ Object

Returns the value of attribute command.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def command
  @command
end

#created ⇒ Object

Returns the value of attribute created.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def created
  @created
end

#hostconfig ⇒ Object

Returns the value of attribute hostconfig.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def hostconfig
  @hostconfig
end

#id ⇒ Object

Returns the value of attribute id.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def id
  @id
end

#image ⇒ Object

Returns the value of attribute image.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def image
  @image
end

#imageid ⇒ Object

Returns the value of attribute imageid.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def imageid
  @imageid
end

#labels ⇒ Object

Returns the value of attribute labels.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def labels
  @labels
end

#names ⇒ Object

Returns the value of attribute names.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def names
  @names
end

#networksettings ⇒ Object

Returns the value of attribute networksettings.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def networksettings
  @networksettings
end

#ports ⇒ Object

Returns the value of attribute ports.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def ports
  @ports
end

#sizerootfs ⇒ Object

Returns the value of attribute sizerootfs.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def sizerootfs
  @sizerootfs
end

#sizerw ⇒ Object

Returns the value of attribute sizerw.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def sizerw
  @sizerw
end

#state ⇒ Object

Returns the value of attribute state.



7
8
9
# File 'lib/hyperb/containers/container.rb', line 7

def state
  @state
end

Instance Method Details

#name ⇒ Object



19
20
21
# File 'lib/hyperb/containers/container.rb', line 19

def name
  names.first
end

#running? ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/hyperb/containers/container.rb', line 23

def running?
  state == 'running'
end