Class: Opal::REPL::Silencer

Inherits:
Object
  • Object
show all
Defined in:
opal/lib/opal/repl.rb

Instance Method Summary collapse

Constructor Details

#initializeSilencer

Returns a new instance of Silencer.



135
136
137
# File 'opal/lib/opal/repl.rb', line 135

def initialize
  @stderr = $stderr
end

Instance Method Details

#silenceObject



139
140
141
142
143
144
145
# File 'opal/lib/opal/repl.rb', line 139

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

#warningsObject



147
148
149
# File 'opal/lib/opal/repl.rb', line 147

def warnings
  @collector.string
end