Permalink
Browse files

make extending Stream with mixins easier

  • Loading branch information...
1 parent c236676 commit 962d3f549ec6b7a2adbbee8438f03b28cdf80d6f @rkh rkh committed Aug 17, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/sinatra/base.rb
View
@@ -243,9 +243,11 @@ def self.defer(*) yield end
def initialize(scheduler = self.class, close = true, &back)
@back, @scheduler, @callback, @close = back.to_proc, scheduler, nil, close
+ super()
end
def close
+ return super if defined? super
@scheduler.schedule { @callback.call if @callback }
end
@@ -267,10 +269,13 @@ def <<(data)
end
def callback(&block)
+ return super if defined? super
@callback = block
end
- alias errback callback
+ def errback
+ super if defined? super
+ end
end
# Allows to start sending data to the client even though later parts of

0 comments on commit 962d3f5

Please sign in to comment.