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.



88
89
90
# File 'opal/opal/corelib/irb.rb', line 88

def initialize
  @stderr = $stderr
end

Instance Method Details

#silenceObject



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

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

#warningsObject



100
101
102
# File 'opal/opal/corelib/irb.rb', line 100

def warnings
  @collector.string
end