summaryrefslogtreecommitdiff
path: root/components/stream.rb
diff options
context:
space:
mode:
Diffstat (limited to 'components/stream.rb')
-rw-r--r--components/stream.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/components/stream.rb b/components/stream.rb
index 73da8b0..0a16dde 100644
--- a/components/stream.rb
+++ b/components/stream.rb
@@ -13,7 +13,11 @@ module NanoBot
@accumulated = "#{@accumulated.force_encoding('UTF-8')}#{args.first.force_encoding('UTF-8')}"
end
- @callback.call(@accumulated, args.first, false, args[1])
+ if @callback.arity == 3
+ @callback.call(@accumulated, args.first, false)
+ else
+ @callback.call(@accumulated, args.first, false, args[1])
+ end
end
super(args.first)
end
@@ -30,7 +34,11 @@ module NanoBot
rewind
if @callback
- @callback.call(@accumulated, nil, true)
+ if @callback.arity == 3
+ @callback.call(@accumulated, nil, true)
+ else
+ @callback.call(@accumulated, nil, true, nil)
+ end
@callback = nil
@accumulated = nil
end