Class: Rexec::Container

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

Overview

Represents a Rexec container/sandbox.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Container

Returns a new instance of Container.



8
9
10
11
12
13
14
15
16
17
# File 'lib/rexec/container.rb', line 8

def initialize(data)
  @id = data["id"]
  @name = data["name"]
  @image = data["image"]
  @status = data["status"]
  @created_at = data["created_at"]
  @started_at = data["started_at"]
  @labels = data["labels"] || {}
  @environment = data["environment"] || {}
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/rexec/container.rb', line 6

def created_at
  @created_at
end

#environmentObject (readonly)

Returns the value of attribute environment.



6
7
8
# File 'lib/rexec/container.rb', line 6

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/rexec/container.rb', line 6

def id
  @id
end

#imageObject (readonly)

Returns the value of attribute image.



6
7
8
# File 'lib/rexec/container.rb', line 6

def image
  @image
end

#labelsObject (readonly)

Returns the value of attribute labels.



6
7
8
# File 'lib/rexec/container.rb', line 6

def labels
  @labels
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/rexec/container.rb', line 6

def name
  @name
end

#started_atObject (readonly)

Returns the value of attribute started_at.



6
7
8
# File 'lib/rexec/container.rb', line 6

def started_at
  @started_at
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/rexec/container.rb', line 6

def status
  @status
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


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

def running?
  status == "running"
end

#stopped?Boolean

Returns:

  • (Boolean)


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

def stopped?
  status == "stopped"
end