Class: XFTP::Session::Base Abstract Private

Inherits:
Object
  • Object
show all
Includes:
DSL::BlockEvaluator, Helpers::Logging
Defined in:
lib/xftp/session/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Base class for xftp session adapters

Direct Known Subclasses

FTP, SFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Logging

#log

Methods included from DSL::BlockEvaluator

#evaluate

Constructor Details

#initialize(uri, settings = {}) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a session adapter instance



17
18
19
20
21
# File 'lib/xftp/session/base.rb', line 17

def initialize(uri, settings = {})
  @uri = uri
  @credentials = settings.delete(:credentials) || {}
  @settings = settings
end

Instance Attribute Details

#credentialsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/xftp/session/base.rb', line 12

def credentials
  @credentials
end

#settingsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/xftp/session/base.rb', line 12

def settings
  @settings
end

#uriObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/xftp/session/base.rb', line 12

def uri
  @uri
end

Instance Method Details

#start(&callback) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Opens a new connection, evaluates the given block and closes the connection



25
26
27
28
29
30
31
# File 'lib/xftp/session/base.rb', line 25

def start(&callback)
  log 'starting'
  open
  evaluate(&callback)
  close
  log 'done'
end