File: open-scp.rb

package info (click to toggle)
ruby-net-scp 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 216 kB
  • sloc: ruby: 1,913; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'open-uri'
require 'uri/scp'
require 'net/scp'

module URI

  class SCP
    def buffer_open(buf, proxy, open_options)
      options = open_options.merge(:port => port, :password => password)
      progress = options.delete(:progress_proc)
      buf << Net::SCP.download!(host, user, path, nil, open_options, &progress)
      buf.io.rewind
    end

    include OpenURI::OpenRead
  end

end