summaryrefslogtreecommitdiff
path: root/lib/net/ssh/multi/channel_proxy.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2008-04-05 22:03:06 -0600
committerJamis Buck <jamis@37signals.com>2008-04-05 22:03:06 -0600
commit6214d1ec6796ffab41b9413840e733a1d5cf70dd (patch)
tree45e4404653ff3ee69b72a060ab6e22c2db926f4f /lib/net/ssh/multi/channel_proxy.rb
parentef95839f420e93f85e179a43bb4e28cb39de0de7 (diff)
downloadnet-ssh-multi-6214d1ec6796ffab41b9413840e733a1d5cf70dd.tar.gz
concurrent session limiting
Diffstat (limited to 'lib/net/ssh/multi/channel_proxy.rb')
-rw-r--r--lib/net/ssh/multi/channel_proxy.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/net/ssh/multi/channel_proxy.rb b/lib/net/ssh/multi/channel_proxy.rb
new file mode 100644
index 0000000..99f7986
--- /dev/null
+++ b/lib/net/ssh/multi/channel_proxy.rb
@@ -0,0 +1,26 @@
+module Net; module SSH; module Multi
+ class ChannelProxy
+ attr_reader :on_confirm
+
+ def initialize(&on_confirm)
+ @on_confirm = on_confirm
+ @recordings = []
+ @channel = nil
+ end
+
+ def delegate_to(channel)
+ @channel = channel
+ @recordings.each do |sym, args, block|
+ @channel.__send__(sym, *args, &block)
+ end
+ end
+
+ def method_missing(sym, *args, &block)
+ if @channel
+ @channel.__send__(sym, *args, &block)
+ else
+ @recordings << [sym, args, block]
+ end
+ end
+ end
+end; end; end \ No newline at end of file