Class URI::SCP
In: lib/uri/open-scp.rb
lib/uri/scp.rb
Parent: Object

Methods

buffer_open   new   new2  

Included Modules

OpenURI::OpenRead

Constants

DEFAULT_PORT = 22
COMPONENT = [ :scheme, :userinfo, :host, :port, :path, :query

Attributes

options  [R] 

Public Class methods

[Source]

    # File lib/uri/scp.rb, line 20
20:     def initialize(*args)
21:       super(*args)
22: 
23:       @options = Hash.new
24:       (query || "").split(/&/).each do |pair|
25:         name, value = pair.split(/=/, 2)
26:         opt_name = name.to_sym
27:         values = value.split(/,/).map { |v| v.to_i.to_s == v ? v.to_i : v }
28:         values = values.first if values.length == 1
29:         options[opt_name] = values
30:       end
31:     end

[Source]

    # File lib/uri/scp.rb, line 16
16:     def self.new2(user, password, host, port, path, query)
17:       new('scp', [user, password], host, port, nil, path, nil, query)
18:     end

Public Instance methods

[Source]

    # File lib/uri/open-scp.rb, line 8
 8:     def buffer_open(buf, proxy, open_options)
 9:       options = open_options.merge(:port => port, :password => password)
10:       progress = options.delete(:progress_proc)
11:       buf << Net::SCP.download!(host, user, path, nil, open_options, &progress)
12:       buf.io.rewind
13:     end

[Validate]