Class: Aspera::Agent::Factory
- Inherits:
-
Object
- Object
- Aspera::Agent::Factory
- Includes:
- Singleton
- Defined in:
- lib/aspera/agent/factory.rb
Overview
Factory for Agents
Instance Method Summary collapse
-
#create(agent, options) ⇒ Object
Create new agent.
-
#list ⇒ Array
Discover available agents.
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, ) Log.dump(:options, ) require "aspera/agent/#{agent}" Aspera::Agent.const_get(agent.to_s.capitalize).new(**) end |
#list ⇒ Array
Discover available agents
21 22 23 24 25 26 |
# File 'lib/aspera/agent/factory.rb', line 21 def list Dir.children(File.dirname(File.(__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 |