Class: HrrRbSftp::Protocol::Version3::Extensions::Extension

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb

Overview

This class implements base extension operations and is to be inherited by each extension class.

Instance Attribute Summary

Attributes included from Loggable

#logger

Instance Method Summary collapse

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn

Constructor Details

#initialize(context, logger: nil) ⇒ Extension

Returns a new instance of a class that includes this module.

Parameters:

  • context (Hash)

    Contextual variables.

    • :version (Integer) - Negotiated protocol version.

    • :handles (Hash{String=>File, Dir}) - Opened handles.

  • logger (Logger) (defaults to: nil)

    Logger.



20
21
22
23
24
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb', line 20

def initialize context, logger: nil
  self.logger = logger

  @context = context
end

Instance Method Details

#contextHash

Returns contextual variables.

Returns:

  • (Hash)

    Contextual variables.

    • :version (Integer) - Negotiated protocol version.

    • :handles (Hash{String=>File, Dir}) - Opened handles.



33
34
35
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb', line 33

def context
  @context
end

#handlesHash{String=>File, Dir}

Returns opened handles.

Returns:

  • (Hash{String=>File, Dir})

    Opened handles.



51
52
53
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb', line 51

def handles
  @context[:handles]
end

#versionInteger

Returns Negotiated protocol version.

Returns:

  • (Integer)

    Negotiated protocol version.



42
43
44
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb', line 42

def version
  @context[:version]
end