Class: Roda::RodaPlugins::SSE::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/roda/plugins/sse.rb

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Body

Returns a new instance of Body.



45
46
47
# File 'lib/roda/plugins/sse.rb', line 45

def initialize(block)
  @block = block
end

Instance Method Details

#call(stream) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/roda/plugins/sse.rb', line 49

def call(stream)
  output = Output.new(stream)
  @block.call(output)
rescue => error
ensure
  stream.close_write(error)
end