Class: Aspera::Agent::Factory

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/aspera/agent/factory.rb

Overview

Factory for Agents

Instance Method Summary collapse

Instance Method Details

#create(agent, options) ⇒ Object

Create new agent



13
14
15
16
17
# File 'lib/aspera/agent/factory.rb', line 13

def create(agent, options)
  Log.dump(:options, options)
  require "aspera/agent/#{agent}"
  Aspera::Agent.const_get(agent.to_s.capitalize).new(**options)
end

#listArray

Discover available agents

Returns:

  • (Array)

    list of symbols of agents



21
22
23
24
25
26
# File 'lib/aspera/agent/factory.rb', line 21

def list
  Dir.children(File.dirname(File.expand_path(__FILE__)))
    .select{ |file| file.end_with?(Environment::RB_EXT)}
    .map{ |file| File.basename(file, Environment::RB_EXT).to_sym}
    .reject{ |item| IGNORED_ITEMS.include?(item)}
end