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.



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

def initialize
  @stderr = $stderr
end

Instance Method Details

#silenceObject



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

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

#warningsObject



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

def warnings
  @collector.string
end