parsing_callback.rb revision 5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39d
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase# enforce eager-loading of parsing classes
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim ReddehaseDir.glob(Rails.root + 'lib/parsing_callback/*.rb').each do |file|
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase require file
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehaseend
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehasemodule ParsingCallback
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase def self.determine_for(ontology)
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase logic_name = ontology.logic.name
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase self.constants.each do |constant|
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase moddule = self.const_get(constant)
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase if moddule.class == Module
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase if moddule.defined_for?(logic_name)
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase return moddule.const_get(:Callback).new(ontology)
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase end
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase end
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase end
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase GenericCallback.new(ontology)
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase end
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehase
5f17dd3e3fd2fe31bb8ad69cc23c49a5fcceb39dTim Reddehaseend