Class: Landlock::SafeExec::Result
- Inherits:
-
Object
- Object
- Landlock::SafeExec::Result
- Defined in:
- lib/landlock/safe_exec.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(stdout:, stderr:, status:, output_truncated: false, timed_out: false) ⇒ Result
constructor
A new instance of Result.
- #inspect ⇒ Object
- #output_truncated? ⇒ Boolean
- #success? ⇒ Boolean
- #timed_out? ⇒ Boolean
- #to_ary ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(stdout:, stderr:, status:, output_truncated: false, timed_out: false) ⇒ Result
Returns a new instance of Result.
28 29 30 31 32 33 34 |
# File 'lib/landlock/safe_exec.rb', line 28 def initialize(stdout:, stderr:, status:, output_truncated: false, timed_out: false) @stdout = stdout @stderr = stderr @status = status @output_truncated = output_truncated @timed_out = timed_out end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
26 27 28 |
# File 'lib/landlock/safe_exec.rb', line 26 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
26 27 28 |
# File 'lib/landlock/safe_exec.rb', line 26 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
26 27 28 |
# File 'lib/landlock/safe_exec.rb', line 26 def stdout @stdout end |
Instance Method Details
#inspect ⇒ Object
56 57 58 |
# File 'lib/landlock/safe_exec.rb', line 56 def inspect "#<#{self.class} status=#{status.inspect} timed_out=#{timed_out?} output_truncated=#{output_truncated?} stdout=#{stdout.inspect} stderr=#{stderr.inspect}>" end |
#output_truncated? ⇒ Boolean
40 41 42 |
# File 'lib/landlock/safe_exec.rb', line 40 def output_truncated? @output_truncated end |
#success? ⇒ Boolean
36 37 38 |
# File 'lib/landlock/safe_exec.rb', line 36 def success? !timed_out? && status&.success? end |
#timed_out? ⇒ Boolean
44 45 46 |
# File 'lib/landlock/safe_exec.rb', line 44 def timed_out? @timed_out end |
#to_ary ⇒ Object
48 49 50 |
# File 'lib/landlock/safe_exec.rb', line 48 def to_ary [stdout, stderr, status] end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/landlock/safe_exec.rb', line 52 def to_s stdout.to_s end |