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

#commandObject

Returns the value of attribute command.



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

def command
  @command
end

#createdObject

Returns the value of attribute created.



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

def created
  @created
end

#hostconfigObject

Returns the value of attribute hostconfig.



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

def hostconfig
  @hostconfig
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#imageObject

Returns the value of attribute image.



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

def image
  @image
end

#imageidObject

Returns the value of attribute imageid.



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

def imageid
  @imageid
end

#labelsObject

Returns the value of attribute labels.



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

def labels
  @labels
end

#namesObject

Returns the value of attribute names.



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

def names
  @names
end

#networksettingsObject

Returns the value of attribute networksettings.



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

def networksettings
  @networksettings
end

#portsObject

Returns the value of attribute ports.



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

def ports
  @ports
end

#sizerootfsObject

Returns the value of attribute sizerootfs.



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

def sizerootfs
  @sizerootfs
end

#sizerwObject

Returns the value of attribute sizerw.



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

def sizerw
  @sizerw
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

Instance Method Details

#nameObject



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