Method: LibSSH.version

Defined in:
ext/libssh_ruby/libssh_ruby.c

.version(req_version = 0) ⇒ String?

When req_version is given, check if libssh is the required version. When req_version isn’t given, return the libssh version string.

Parameters:

  • req_version (Fixnum) (defaults to: 0)

    The version required.

Returns:

  • (String, nil)

    The libssh version string if it’s newer than req_version .

See Also:

Since:

  • 0.2.0



17
18
19
20
21
22
23
24
25
26
27
# File 'ext/libssh_ruby/libssh_ruby.c', line 17

static VALUE m_version(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self)) {
  VALUE req_version;
  int c_req_version = 0;

  rb_scan_args(argc, argv, "01", &req_version);
  if (!NIL_P(req_version)) {
    Check_Type(req_version, T_FIXNUM);
    c_req_version = FIX2INT(req_version);
  }
  return rb_str_new_cstr(ssh_version(c_req_version));
}