module Nrb::Utils

Utility methods to be used in other places.

Public Instance Methods

console() click to toggle source

Use Pry if available

# File lib/nrb/utils.rb, line 15
def console
  defined?(Pry) ? Pry : IRB
end
silently() { || ... } click to toggle source

Supress STDOUT for the duration of the block.

# File lib/nrb/utils.rb, line 7
def silently
  original = $stdout.dup
  $stdout.reopen(File::NULL)
  yield
  $stdout.reopen(original)
end