Class: OsCtld::ContainerControl::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/container_control/result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, data: nil, message: nil) ⇒ Result

Returns a new instance of Result



15
16
17
18
19
# File 'lib/osctld/container_control/result.rb', line 15

def initialize(status, data: nil, message: nil)
  @status = status
  @data = data
  @message = message
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data



13
14
15
# File 'lib/osctld/container_control/result.rb', line 13

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message



13
14
15
# File 'lib/osctld/container_control/result.rb', line 13

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status



13
14
15
# File 'lib/osctld/container_control/result.rb', line 13

def status
  @status
end

Class Method Details

.from_runner(data) ⇒ ContainerControl::Result

Create result from the runner's output



5
6
7
8
9
10
11
# File 'lib/osctld/container_control/result.rb', line 5

def self.from_runner(data)
  if data[:status]
    new(true, data: data[:output])
  else
    new(false, message: data[:message])
  end
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/osctld/container_control/result.rb', line 21

def ok?
  status ? true : false
end