Class: Sprint::Status

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output, status) ⇒ Status

Returns a new instance of Status.



7
8
9
10
# File 'lib/sprint.rb', line 7

def initialize( output, status )
  @output = output
  @status = status
end

Class Method Details

.run(command) ⇒ Object



39
40
41
42
43
# File 'lib/sprint.rb', line 39

def self.run( command )
  output = `#{command}`
  status = $?
  Status.new output, status
end

Instance Method Details

#checkObject



23
24
25
26
# File 'lib/sprint.rb', line 23

def check
  raise "Process exited with error code: #{return_code}" unless success?
  self
end

#good_outputObject



18
19
20
21
# File 'lib/sprint.rb', line 18

def good_output
  check
  @output
end

#success?Boolean Also known as: to_b

Returns:

  • (Boolean)


34
35
36
# File 'lib/sprint.rb', line 34

def success?
  @status.success?
end

#to_iObject Also known as: return_code, to_int



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

def to_i
  @status.exitstatus
end

#to_sObject Also known as: output, to_str



12
13
14
# File 'lib/sprint.rb', line 12

def to_s
  @output
end