Module: Kernel

Defined in:
lib/nose/util.rb,
lib/nose/util.rb

Overview

Extend the kernel to allow warning suppression

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pp_s(*objs) ⇒ String

Pretty print to a string

Returns:

  • (String)


186
187
188
189
190
191
# 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

Instance Method Details

#suppress_warningsvoid

This method returns an undefined value.

Allow the suppression of warnings for a block of code



219
220
221
222
223
224
225
226
# File 'lib/nose/util.rb', line 219

def suppress_warnings
  original_verbosity = $VERBOSE
  $VERBOSE = nil
  result = yield
  $VERBOSE = original_verbosity

  result
end