Class: Britebox::FilteredErrorIO

Inherits:
IO
  • Object
show all
Defined in:
lib/britebox/filtered_error_io.rb

Constant Summary collapse

BLACKLIST =
['has taken the stage', 'Listen warning', 'Listen will be polling']

Instance Method Summary collapse

Constructor Details

#initialize(original_stderr) ⇒ FilteredErrorIO

Returns a new instance of FilteredErrorIO.



5
6
7
# File 'lib/britebox/filtered_error_io.rb', line 5

def initialize(original_stderr)
  @stderr = original_stderr
end

Instance Method Details

#restore!Object



17
18
19
# File 'lib/britebox/filtered_error_io.rb', line 17

def restore!
  $stderr = @stderr
end

#write(string) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/britebox/filtered_error_io.rb', line 9

def write(string)
  if string.match(/^[\s]*$/) || BLACKLIST.any?{ |b| string.include?(b) }
    # do nothing
  else
    @stderr.puts string
  end
end