Class: Docker::Cli::CommandResult

Inherits:
Object
  • Object
show all
Includes:
TR::CondUtils
Defined in:
lib/docker/cli/command_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result, out, err) ⇒ CommandResult

Returns a new instance of CommandResult.



12
13
14
15
16
# File 'lib/docker/cli/command_result.rb', line 12

def initialize(result, out, err)
  @result = result
  @out = out
  @err = err
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



11
12
13
# File 'lib/docker/cli/command_result.rb', line 11

def err
  @err
end

#outObject (readonly)

Returns the value of attribute out.



11
12
13
# File 'lib/docker/cli/command_result.rb', line 11

def out
  @out
end

#resultObject (readonly)

Returns the value of attribute result.



11
12
13
# File 'lib/docker/cli/command_result.rb', line 11

def result
  @result
end

Instance Method Details

#each_line(&block) ⇒ Object



47
48
49
# File 'lib/docker/cli/command_result.rb', line 47

def each_line(&block)
  out_stream.each_line(&block)
end

#err_streamObject



30
31
32
# File 'lib/docker/cli/command_result.rb', line 30

def err_stream
  @err.join("\n")
end

#failed?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
# File 'lib/docker/cli/command_result.rb', line 34

def failed?
  if @result.nil?
    true
  else
    @result.failed?
  end
end

#is_err_stream_empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/docker/cli/command_result.rb', line 22

def is_err_stream_empty?
  is_empty?(@err)
end

#is_out_stream_empty?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/docker/cli/command_result.rb', line 18

def is_out_stream_empty?
  is_empty?(@out)
end

#linesObject



51
52
53
# File 'lib/docker/cli/command_result.rb', line 51

def lines
  out_stream.lines
end

#out_streamObject



26
27
28
# File 'lib/docker/cli/command_result.rb', line 26

def out_stream
  @out.join("\n") 
end

#success?Boolean Also known as: successful?

Returns:

  • (Boolean)


42
43
44
# File 'lib/docker/cli/command_result.rb', line 42

def success?
  not failed?
end