Sha256: c61831f2a83323cad298208f06e03408a3eb34bb201ed586260209d34184da2d
Contents?: true
Size: 1.53 KB
Versions: 9
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true module Mutant # The outer world IO objects mutant does interact with class World include Adamantium, Anima.new( :condition_variable, :environment_variables, :gem, :gem_method, :io, :json, :kernel, :load_path, :marshal, :mutex, :object_space, :open3, :pathname, :process, :stderr, :stdout, :thread, :timer ) INSPECT = '#<Mutant::World>' private_constant(*constants(false)) # Object inspection # # @return [String] def inspect INSPECT end # Capture stdout of a command # # @param [Array<String>] command # # @return [Either<String,String>] 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 # Try const get # # @param [String] # # @return [Class|Module|nil] # # rubocop:disable Lint/SuppressedException def try_const_get(name) kernel.const_get(name) rescue NameError end # rubocop:enable Lint/SuppressedException # Deadline # # @param [Float, nil] allowed_time def deadline(allowed_time) if allowed_time Timer::Deadline.new( allowed_time: allowed_time, timer: timer ) else Timer::Deadline::None.new end end end # World end # Mutant
Version data entries
9 entries across 9 versions & 1 rubygems