Skip to content

Commit f7bbf1b

Browse files
committed
feat: use Err type rather than a tuple
- Release v0.2.2
1 parent a0b6839 commit f7bbf1b

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
rb-process (0.2.1)
4+
rb-process (0.2.2)
55

66
GEM
77
remote: https://rubygems.org/

lib/rb/process.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ def initialize(input, output, error)
1717
end
1818
end
1919

20+
class Err
21+
attr_reader :stdout
22+
attr_reader :stderr
23+
attr_reader :status
24+
25+
def initialize(stdout, stderr, status)
26+
@stdout = stdout
27+
@stderr = stderr
28+
@status = status
29+
end
30+
end
31+
2032
def self.run(*args, output: STDOUT, error: STDERR, **options, &block)
2133
output_strio = StringIO.new
2234
error_strio = StringIO.new
@@ -89,7 +101,7 @@ def self.run(*args, output: STDOUT, error: STDERR, **options, &block)
89101
when true
90102
output_strio.string
91103
else
92-
[output_strio.string, error_strio.string, status]
104+
Err.new(output_strio.string, error_strio.string, status)
93105
end
94106
end
95107

lib/rb/process/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Process
4-
VERSION = "0.2.1"
4+
VERSION = "0.2.2"
55
end

spec/rb/process_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
when String
2626
expect(r.chomp).to eq "good"
2727
else
28-
o, e, s = r
29-
expect(o.chomp).to eq "good"
30-
expect(e.chomp).to eq "bad"
31-
expect(s.exitstatus).to eq 1
28+
expect(r.stdout.chomp).to eq "good"
29+
expect(r.stderr.chomp).to eq "bad"
30+
expect(r.status.exitstatus).to eq 1
3231
end
3332
end
3433

0 commit comments

Comments
 (0)