Class: Traceur::Node::CommandResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/traceur/node/command_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CommandResult

Returns a new instance of CommandResult.



4
5
6
7
8
# File 'lib/traceur/node/command_result.rb', line 4

def initialize(opts = {})
  self.status = opts[:status]
  self.stdout = opts[:stdout]
  self.stderr = opts[:stderr]
end

Instance Attribute Details

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



3
4
5
# File 'lib/traceur/node/command_result.rb', line 3

def status
  @status
end

#stderrObject

Returns the value of attribute stderr

Returns:

  • (Object)

    the current value of stderr



3
4
5
# File 'lib/traceur/node/command_result.rb', line 3

def stderr
  @stderr
end

#stdoutObject

Returns the value of attribute stdout

Returns:

  • (Object)

    the current value of stdout



3
4
5
# File 'lib/traceur/node/command_result.rb', line 3

def stdout
  @stdout
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/traceur/node/command_result.rb', line 15

def error?
  !success?
end

#exit_statusObject



23
24
25
# File 'lib/traceur/node/command_result.rb', line 23

def exit_status
  status.exitstatus
end

#on_error {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
# File 'lib/traceur/node/command_result.rb', line 10

def on_error
  yield(self) if error?
  self
end

#success?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/traceur/node/command_result.rb', line 19

def success?
  exit_status == 0
end