Class: Opal::REPL::Silencer
- Inherits:
-
Object
- Object
- Opal::REPL::Silencer
- Defined in:
- opal/lib/opal/repl.rb
Instance Method Summary collapse
-
#initialize ⇒ Silencer
constructor
A new instance of Silencer.
- #silence ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize ⇒ Silencer
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
#silence ⇒ Object
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 |
#warnings ⇒ Object
148 149 150 |
# File 'opal/lib/opal/repl.rb', line 148 def warnings @collector.string end |