Sha256: 1924d78f4eb6af59637a629dae9274c128de4c2f786ea5fb5c1ed1f25d432988

Contents?: true

Size: 810 Bytes

Versions: 6

Compression:

Stored size: 810 Bytes

Contents

=begin rdoc
  Kernel overloads
=end
module Kernel
  # Nice wait instead of sleep
  def wait(time=5)
    sleep time.is_a?(String) ? eval(time) : time
  end
  def as(klass_or_obj, &block)
    block.in_context(klass_or_obj).call
  end
  def load_p(dir)
    Dir["#{dir}/*.rb"].each do |file|
      require "#{file}" if ::FileTest.file?(file)
    end
    Dir["#{dir}/*"].each do |dir|
      load_p(dir) if ::FileTest.directory?(dir)
    end
  end
  def with_warnings_suppressed
    saved_verbosity = $-v
    $-v = nil
    yield
  ensure
    $-v = saved_verbosity
  end
  def hide_output
    begin
      old_stdout = STDOUT.dup
      STDOUT.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
      yield if block_given?
    ensure
      STDOUT.flush
      STDOUT.reopen(old_stdout)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
auser-poolparty-0.2.22 lib/poolparty/core/kernel.rb
auser-poolparty-0.2.23 lib/poolparty/core/kernel.rb
auser-poolparty-0.2.24 lib/poolparty/core/kernel.rb
auser-poolparty-0.2.25 lib/poolparty/core/kernel.rb
auser-poolparty-0.2.26 lib/poolparty/core/kernel.rb
auser-poolparty-0.2.35 lib/poolparty/core/kernel.rb