Class: ActionManager
- Inherits:
-
Object
- Object
- ActionManager
- Defined in:
- lib/seqtrimnext/classes/action_manager.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ActionManager
constructor
Storages the necessary plugins specified in ‘plugin_list’ and start the loading of plugins.
-
#load_actions_from_files ⇒ Object
Iterates by the files from the folder ‘actions’, and load it.
Constructor Details
#initialize ⇒ ActionManager
Storages the necessary plugins specified in ‘plugin_list’ and start the loading of plugins
9 10 11 12 |
# File 'lib/seqtrimnext/classes/action_manager.rb', line 9 def initialize load_actions_from_files end |
Class Method Details
.new_action(start_pos, end_pos, action_type) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/seqtrimnext/classes/action_manager.rb', line 14 def self.new_action(start_pos,end_pos,action_type) action_class = Object.const_get(action_type) # DONE mirar si la action_class es de verdad una action existente res = nil if !action_class.nil? && action_class.ancestors.include?(SeqtrimAction) res= action_class.new(start_pos,end_pos) else #$LOG.error ' Error. Don´t exist the action: ' + action_class.to_s puts ' Error. The action : ' + action_class.to_s+ ' does not exists' end return res end |
Instance Method Details
#load_actions_from_files ⇒ Object
Iterates by the files from the folder ‘actions’, and load it
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/seqtrimnext/classes/action_manager.rb', line 31 def load_actions_from_files ignore = ['.','..','seqtrim_action.rb'] #carpeta=Dir.open("progs/ruby/seqtrimii/actions") actions_path = File.(File.join(File.dirname(__FILE__), "..","actions")) if !File.exists?(actions_path) raise "Action folder does not exists" end carpeta=Dir.open(actions_path) carpeta.entries.each do |action| if !ignore.include?(action) require action end # end if end # end each end |