Skip to content

Instantly share code, notes, and snippets.

@hinrik
Last active December 21, 2015 12:58
Show Gist options
  • Save hinrik/6308937 to your computer and use it in GitHub Desktop.
Save hinrik/6308937 to your computer and use it in GitHub Desktop.
require 'celluloid/io'
require 'celluloid/autostart'
require 'net/sftp'
class Foo
include Celluloid::IO
def initialize
async.connect_and_stat
end
def connect_and_stat
# without celluloid-io
#@sftp = Net::SFTP.start('localhost', ENV['USER'])
# with celluloid-io
@sftp = Net::SFTP.start('localhost', ENV['USER'], proxy: TCPSocket)
stat = @sftp.stat!('/etc/passwd')
p stat
terminate
end
end
Foo.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment