Class: Mutant::World Private

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
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

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

Instance Method Details

#capture_stdout(command) ⇒ Either<String,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.

Capture stdout of a command

Parameters:

  • command (Array<String>)

Returns:



43
44
45
46
47
48
49
50
51
# File 'lib/mutant/world.rb', line 43

def capture_stdout(command)
  stdout, status = open3.capture2(*command, binmode: true)

  if status.success?
    Either::Right.new(stdout)
  else
    Either::Left.new("Command #{command} failed!")
  end
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

Parameters:

  • allowed_time (Float, nil)


56
57
58
59
60
61
62
63
64
65
# File 'lib/mutant/world.rb', line 56

def deadline(allowed_time)
  if allowed_time
    Timer::Deadline.new(
      allowed_time: allowed_time,
      timer:        timer
    )
  else
    Timer::Deadline::None.new
  end
end

#inspectString

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

Returns:

  • (String)


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

def inspect
  INSPECT
end