Module: LibSSH2::Native
- Defined in:
- lib/libssh2/native.rb,
lib/libssh2/native/error.rb,
lib/libssh2/native/error_codes.rb,
ext/libssh2_ruby_c/libssh2_ruby_c.c
Overview
This module is almost completely implemented in pure C. Additional methods are defined here to make things easier to implement.
Defined Under Namespace
Modules: Error Classes: Channel, Session
Class Method Summary (collapse)
-
+ (Object) channel_open_session(session)
Channel Methods ----------------------------------------------------------------.
-
+ (Object) proxy_method(*args)
This is a helper to define proxy methods on this module.
-
+ (Object) session_init
Session Methods ----------------------------------------------------------------.
Class Method Details
+ (Object) channel_open_session(session)
Channel Methods
46 47 48 |
# File 'lib/libssh2/native.rb', line 46 def self.channel_open_session(session) Native::Channel.new(session) end |
+ (Object) proxy_method(*args)
This is a helper to define proxy methods on this module. Many methods are proxied to their respective objects, and this lets us do it really easily, concisely.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/libssh2/native.rb', line 8 def self.proxy_method(*args) if args.length != 2 && args.length != 3 raise ArgumentError, "2 or 3 arguments required." end prefix = nil prefix = args.shift if args.length == 3 name = args.shift klass = args.shift method_name = name method_name = "#{prefix}_#{name}" if prefix = class << self; self; end .send(:define_method, method_name) do |object, *args| if !object.kind_of?(klass) raise ArgumentError, "Receiving object must be a: #{klass}" end object.send(name, *args) end end |
+ (Object) session_init
Session Methods
33 34 35 |
# File 'lib/libssh2/native.rb', line 33 def self.session_init Native::Session.new end |