Sha256: 95cbaed41c8eee9beb9ca80033333bcf451c38feb2756aee8e16887459de5c35

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

# Overrides standard ruby method_missing interceptor.
# NOTE:
#   This is a workaround for standard method_missing 
#   generates very high CPU usage
#   when a significant model is loaded in memory.
#:include: ../shared/license.rdoc


def method_missing(methId,args=nil)
		msg=respond_to?(:rdf_uri) ? "#{rdf_uri}" : "nil"
		log.error { "method #{methId} not available for object of class #{self.class.name}, (uri=#{msg})(to_s=#{self})" }

		if msg=="ukb_null" 
			log.error { <<-END 
********** INVALID MODEL DETECTED **********
********** INVALID MODEL DETECTED **********
**** An invalid source model was used (an ukb_null was found).
**** Probable cause is that you are using a RSM modeler, and 
**** one of your model contains an invalid reference somewhere.
****
**** Because RSM does not tell you where this error is located,
**** you have to use your .nt export file :
****
**** 1) open .nt export file with a text editor.
**** 2) locate <http://kb#null> string.
**** 3) locate left member refering to this null element.
**** 4) This element is the key of RSM invalid element.
**** 5) Locate this element in RSM and fix it (or delete it).
**** 6) Re-export your model and check for null uris.
****
********** INVALID MODEL DETECTED **********
		END
			}
		end

		log.debug {
			msg=""
			self.methods.sort{|a,b| a<=>b}.each {|m|
				msg="#{msg}, #{m}"
			}
			"Available methods are: #{msg}" 
		}

		#self.included_modules.each { |m| 
		#	#puts "include #{m}"
		#	}
		puts "end of custom method_missing" 
		#TODO: l'appel au stock method_missing genere des temps de traitements infinis. (cpu a 100%, conso memoire enorme)
		#super
		puts "exiting"
		throw NoMethodError.new("method missing '#{methId}' for object '#{self.class.name}'",methId,args)
		#exit
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ontomde-core-1.0.2 lib/ontomde-core/custom_method_missing.rb