class ActionManager

Public Class Methods

new() click to toggle source

Storages the necessary plugins specified in 'plugin_list' and start the loading of plugins

# File lib/seqtrimnext/classes/action_manager.rb, line 9
def initialize 
  
  load_actions_from_files
end
new_action(start_pos,end_pos,action_type) click to toggle source
# 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

Public Instance Methods

load_actions_from_files() click to toggle source

Iterates by the files from the folder 'actions', and load it

# 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.expand_path(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