Class: Opal::IRB::Silencer

Inherits:
Object show all
Defined in:
opal/opal/corelib/irb.rb

Instance Method Summary collapse

Constructor Details

#initializeSilencer

Returns a new instance of Silencer.



90
91
92
# File 'opal/opal/corelib/irb.rb', line 90

def initialize
  @stderr = $stderr
end

Instance Method Details

#silenceObject



94
95
96
97
98
99
100
# File 'opal/opal/corelib/irb.rb', line 94

def silence
  @collector = ::StringIO.new
  $stderr = @collector
  yield
ensure
  $stderr = @stderr
end

#warningsObject



102
103
104
# File 'opal/opal/corelib/irb.rb', line 102

def warnings
  @collector.string
end