module Kernel

Add a simple function for pretty printing strings

Extend the kernel to allow warning suppression

Public Class Methods

pp_s(*objs) click to toggle source

Pretty print to a string @return [String]

# File lib/nose/util.rb, line 186
def pp_s(*objs)
  s = StringIO.new
  objs.each { |obj| PP.pp(obj, s) }
  s.rewind
  s.read
end

Public Instance Methods

suppress_warnings() { || ... } click to toggle source

Allow the suppression of warnings for a block of code @return [void]

# File lib/nose/util.rb, line 219
def suppress_warnings
  original_verbosity = $VERBOSE
  $VERBOSE = nil
  result = yield
  $VERBOSE = original_verbosity

  result
end

Private Instance Methods

pp_s(*objs) click to toggle source

Pretty print to a string @return [String]

# File lib/nose/util.rb, line 186
def pp_s(*objs)
  s = StringIO.new
  objs.each { |obj| PP.pp(obj, s) }
  s.rewind
  s.read
end