Class: Webtask::StreamError

Inherits:
Object
  • Object
show all
Defined in:
lib/webtask/stream_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ StreamError

Returns a new instance of StreamError.



3
4
5
6
# File 'lib/webtask/stream_error.rb', line 3

def initialize(stream)
  @stream = stream
  @errors = false
end

Instance Method Details

#errors?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/webtask/stream_error.rb', line 8

def errors?
  @errors
end

#write(data) ⇒ Object



12
13
14
15
16
# File 'lib/webtask/stream_error.rb', line 12

def write(data)
  @errors = true
  @stream << "event: stderr\n"
  @stream << "data: #{data}\n\n"
end