Module: Nrb::Utils

Defined in:
lib/nrb/utils.rb

Overview

Utility methods to be used in other places.

Class Method Summary collapse

Class Method Details

.consoleObject

Use Pry if available



15
16
17
# File 'lib/nrb/utils.rb', line 15

def console
  defined?(Pry) ? Pry : IRB
end

.silentlyObject

Supress STDOUT for the duration of the block.



7
8
9
10
11
12
# File 'lib/nrb/utils.rb', line 7

def silently
  original = $stdout.dup
  $stdout.reopen(File::NULL)
  yield
  $stdout.reopen(original)
end