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, user_runner: false) ⇒ Result

Returns a new instance of Result.



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

def initialize(status, data: nil, message: nil, user_runner: false)
  @status = status
  @data = data
  @message = message
  @user_runner = user_runner
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)


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

def ok?
  status ? true : false
end

#user_runner?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/osctld/container_control/result.rb', line 26

def user_runner?
  @user_runner
end