Class: Mutant::World Private

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

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:



47
48
49
50
51
52
53
54
55
# File 'lib/mutant/world.rb', line 47

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)


73
74
75
76
77
78
79
80
81
82
# File 'lib/mutant/world.rb', line 73

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)


38
39
40
# File 'lib/mutant/world.rb', line 38

def inspect
  INSPECT
end

#process_warmupObject

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.



88
89
90
# File 'lib/mutant/world.rb', line 88

def process_warmup
  process.warmup if process.respond_to?(:warmup)
end

#record(name, &block) ⇒ 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.



84
85
86
# File 'lib/mutant/world.rb', line 84

def record(name, &block)
  recorder.record(name, &block)
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

Parameters:

  • (String)

Returns:

  • (Class|Module|nil)


64
65
66
67
# File 'lib/mutant/world.rb', line 64

def try_const_get(name)
  kernel.const_get(name)
rescue NameError
end