Class: Hatchet::BashResult

Inherits:
Object
  • Object
show all
Defined in:
lib/hatchet/heroku_run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:, status:, set_global_status: false) ⇒ BashResult

Returns a new instance of BashResult.



7
8
9
10
11
12
# File 'lib/hatchet/heroku_run.rb', line 7

def initialize(stdout:, stderr:, status:, set_global_status: false)
  @stdout = stdout
  @stderr = stderr
  @status = status.respond_to?(:exitstatus) ? status.exitstatus : status.to_i
  `exit #{@status}` if set_global_status
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/hatchet/heroku_run.rb', line 5

def status
  @status
end

#stderrObject (readonly)

Returns the value of attribute stderr.



5
6
7
# File 'lib/hatchet/heroku_run.rb', line 5

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



5
6
7
# File 'lib/hatchet/heroku_run.rb', line 5

def stdout
  @stdout
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/hatchet/heroku_run.rb', line 19

def failed?
  !success?
end

#include?(value) ⇒ Boolean

Testing helper methods

Returns:

  • (Boolean)


24
25
26
# File 'lib/hatchet/heroku_run.rb', line 24

def include?(value)
  stdout.include?(value)
end

#match(value) ⇒ Object



32
33
34
# File 'lib/hatchet/heroku_run.rb', line 32

def match(value)
  stdout.match(value)
end

#match?(value) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/hatchet/heroku_run.rb', line 28

def match?(value)
  stdout.match?(value)
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/hatchet/heroku_run.rb', line 15

def success?
  @status == 0
end