Class: Mutant::World Private
- Inherits:
-
Object
- Object
- Mutant::World
- Includes:
- Unparser::Adamantium
- Defined in:
- lib/mutant/world.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The outer world IO objects mutant does interact with
Defined Under Namespace
Classes: CommandStatus
Constant Summary collapse
- INSPECT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'#<Mutant::World>'
Instance Method Summary collapse
-
#capture_command(command) ⇒ Either<CommandStatus,CommandStatus>
private
Capture stdout of a command.
-
#deadline(allowed_time) ⇒ Object
private
Deadline.
-
#inspect ⇒ String
private
Object inspection.
- #process_warmup ⇒ Object private
- #record(name) ⇒ Object private
-
#try_const_get(name) ⇒ Class|Module|nil
private
Try const get.
Instance Method Details
#capture_command(command) ⇒ Either<CommandStatus,CommandStatus>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Capture stdout of a command
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mutant/world.rb', line 51 def capture_command(command) stdout, stderr, process_status = open3.capture3(*command, binmode: true) (process_status.success? ? Either::Right : Either::Left).new( CommandStatus.new( process_status:, stderr:, stdout: ) ) end |
#deadline(allowed_time) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deadline
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/mutant/world.rb', line 79 def deadline(allowed_time) if allowed_time Timer::Deadline.new( allowed_time:, timer: ) else Timer::Deadline::None.new end end |
#inspect ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Object inspection
38 39 40 |
# File 'lib/mutant/world.rb', line 38 def inspect INSPECT end |
#process_warmup ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 |
# File 'lib/mutant/world.rb', line 94 def process_warmup process.warmup if process.respond_to?(:warmup) end |
#record(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
90 91 92 |
# File 'lib/mutant/world.rb', line 90 def record(name, &) recorder.record(name, &) end |
#try_const_get(name) ⇒ Class|Module|nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Try const get
rubocop:disable Lint/SuppressedException
70 71 72 73 |
# File 'lib/mutant/world.rb', line 70 def try_const_get(name) kernel.const_get(name) rescue NameError end |